awslabs/aws-jwt-verify

[BUG] Cannot find module '#node-web-compat' after upgrading from 2.1.3 to 3.0.0

WtfJoke opened this issue · 2 comments

Describe the bug
After upgrading from aws-jwt-verify from 2.1.3 to 3.0.0 I receive following stacktrace when executing a sample jest test:

jwtVerifier.spec.ts
  ● Test suite failed to run

    Cannot find module '#node-web-compat' from '../../node_modules/aws-jwt-verify/dist/cjs/https.js'

    Require stack:
      ..../node_modules/aws-jwt-verify/dist/cjs/https.js
      ..../node_modules/aws-jwt-verify/dist/cjs/jwk.js
      ..../node_modules/aws-jwt-verify/dist/cjs/jwt-rsa.js
      ..../node_modules/aws-jwt-verify/dist/cjs/index.js

Versions
Which version of aws-jwt-verify are you using? 3.0.0
Are you using the library in Node.js or in the Web browser? Node.js
If Node.js, which version of Node.js are you using? (Should be at least 14) 14 / 17
If Web browser, which web browser and which version of it are you using?
If using TypeScript, which version of TypeScript are you using? (Should be at least 4) 4.6.3

To Reproduce
If you can, please provide a minimal code example that reproduces the bug.

Currently I dont have a minimal code example.

This is an issue in Jest, see #66 on how to work around it.

Your +1 against the Jest issue would be appreciated, to (hopefully) get it prioritized: jestjs/jest#12270

Thanks for your fast response! I've gave the jest issue a thumbs up and going to try the solution with the moduleNameMapper.