Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

TypeError: getCurves is not a function #6

Open
mauryakrishna opened this issue Dec 20, 2020 · 5 comments
Open

TypeError: getCurves is not a function #6

mauryakrishna opened this issue Dec 20, 2020 · 5 comments

Comments

@mauryakrishna
Copy link

Description

I just installed this package and starting my app. Before it could invoke the method it fails at import statement I think. It fails to start the app. I tried via import and require both but made no difference.
[Description of the bug or feature]
image

Could not find any solution for this seems I am first to encounter this.

@maximivanov
Copy link
Owner

Hey @mauryakrishna

Are you trying to run it in a browser? This library uses https://github.com/panva/jose which in turn uses node's crypto module. It may not be available in the browser. It's been reported here panva/jose#72.

New version of jose was released recently and it no longer has any dependencies. I will update cognito-jwt-verifier to use jose v3 which should resolve the issue.

@mauryakrishna
Copy link
Author

@maximivanov Thanks a lot for quick response.

Yes, I was running it in browser in React application. In the mean time you update the jose to v3 can I do some work around to try out for my purpose? Just checking I could save some time and when it updated with new version I can directly use it.

@maximivanov
Copy link
Owner

Unfortunately I don't think there's a quick workaround. If you want to play with it, you'd need to

  • upgrade jose to the latest version and make sure its breaking changes are not affecting cognito-jwt-verifier
  • update fetchKeyStore function to work in both node and browser environments (currently it uses https core node module). In the browser env it probably should use fetch instead.

I've started working on the new version but I can't tell when it's going to be ready.

@maximivanov
Copy link
Owner

@mauryakrishna if it's still relevant, I've just published a new version (beta tag for now).

You can try it with npm i @southlane/cognito-jwt-verifier@beta

Note if your React app is built with create-react-app it won't work unfortunately, since CRA is still using webpack v4 and in order to bundle underlying jose library webpack v5 is required.

I managed to test it with React though (not using CRA): https://github.com/maximivanov/cognito-jwt-verifier/tree/feat/upgradeToJoseV3/example/react

Let me know how it goes (or if you found another solution!).

Cheers.

@mauryakrishna
Copy link
Author

@maximivanov Thanks for taking it so quick. I needed some solution urgently so I went ahead with other solution. But yes we are using CRA v4 so again I wont be able to use this one.

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

No branches or pull requests

2 participants