awslabs/aws-jwt-verify

Browser support

Closed this issue · 5 comments

Question
Hi. I want to use this lib as pure js to be used in browser.
As documented, it support browser. But I didn't get a luck with it.
I also tried browersify, esbuild but no luck.

Versions
Which version of aws-jwt-verify are you using?
I tried 4.0.0, it gave some error. Hence downgraded to "aws-jwt-verify": "^2.1.3",

Are you using the library in Node.js or in the Web browser?
Web browser

If Web browser, which web browser and which version of it are you using?
Chrome, Firefox

when i user browserify, i get following error:
TypeError: The "listener" argument must be of type Function. Received type object

when i upgrade the library version to 4.0.0, i get a error during browsification:

Error: Can't walk dependency graph: Cannot find module '#node-web-compat' from '/node_modules/aws-jwt-verify/dist/cjs/jwt-rsa.js'

Hi @leenabora !

Best use esbuild or webpack they should both work with the latest version of this lib out of the box. rollup needs a bit of extra config. Here is a Vite example showing how to use the lib in web, with the additional rollup config: https://github.com/awslabs/aws-jwt-verify/tree/main/tests/vite-app

If that doesn't help you please provide us steps to reproduce, showing exactly what you are trying.

you are right. It worked with esbuild. Thanks for your help.

Awesome! You're welcome