Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Fixed date-fns requires #310

Closed
wants to merge 1 commit into from
Closed

Fixed date-fns requires #310

wants to merge 1 commit into from

Conversation

jonasclement
Copy link

It looks like date-fns changed the way they export their functions, which causes this error when trying to do an authorization code flow:

Access token error TypeError: addSeconds is not a function
    at getExpirationDate (access-token.js:13)
    at parseToken (access-token.js:28)
    at new AccessToken (access-token.js:51)
    at Object.create (access-token.js:41)

I branched from 3.3.0 as I can see that you've refactored the whole access-token.js file since that release, but from what I've seen you're still calling require() in a way that is broken.

@jonathansamines
Copy link
Collaborator

@jonasclement I just checked this, and wasn't able to reproduce. date-fns exports are still working.

@jonasclement
Copy link
Author

Interesting. What version of date-fns was installed in your case? For me, it installed version 2.11.0, though forcing version 2.9.0 didn't seem to make a difference.

I'm using node version 12.13.0 in my application where I'm getting those errors.

@plemarquand
Copy link

I'm experiencing this as well. addSeconds is exported as a module but is being required.

@jonathansamines
Copy link
Collaborator

@plemarquand @jonasclement can you put together an isolated reproduction example? That way I can take a look at the issue as I am not experiencing it by myself.

@plemarquand
Copy link

@jonathansamines
Copy link
Collaborator

@plemarquand Oh, so the problem is when used along with webpack. Is the proposed fix, actually fix the issue when used along with it?

@jonasclement
Copy link
Author

jonasclement commented Mar 31, 2020

@jonathansamines I'm using it along with webpack too, my bad. The fix I proposed worked for me, at least.

@jonathansamines
Copy link
Collaborator

@jonasclement Can I ask you two things:

  • Implement the fix from whatever changes are on master. I will make sure to get that version published
  • Is there a way to test this module will continue to work when bundled with webpack?
  • Is this a new issue, or has always been broken when used with webpack?

Thanks for your help!

@jonasclement
Copy link
Author

jonasclement commented Apr 1, 2020

@jonathansamines I'll see if I can find time for it, I'll send a new PR.

I'm not sure on your other questions, as I'm a relative node/js rookie. Maybe @plemarquand knows.

@jonasclement
Copy link
Author

I've made the requested changes in #312.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants