πŸ› BUG: "Module cannot be synchronously ...

Hello! πŸ‘‹ I'm currently trying to migrate our test suite to Vite + the new pool workers, and I have run into this issue while doing so: https://github.com/cloudflare/workers-sdk/issues/5367 β€”Β is this a known issue? Any recommendations?
3 Replies
MrBBot
MrBBotβ€’8mo ago
Hey! πŸ‘‹ Unfortunately, the Workers Vitest integration doesn't support modules with cyclic require()s. This is a known issue which we currently don't have a good workaround for. I'd encourage you to use a library which supports Workers natively such as jose (https://github.com/panva/jose) instead of jsonwebtoken.
GitHub
GitHub - panva/jose: JWA, JWS, JWE, JWT, JWK, JWKS for Node.js, Bro...
JWA, JWS, JWE, JWT, JWK, JWKS for Node.js, Browser, Cloudflare Workers, Deno, Bun, and other Web-interoperable runtimes. - panva/jose
Vincent
VincentOPβ€’8mo ago
@MrBBot Thanks! Good to know it's a known thing then. We can work around this one in particular without too much trouble. I also found an issue with itty-router-extras, which results in a different error "No such module". What's the issue in that particular case?
MrBBot
MrBBotβ€’8mo ago
Could you share the full stack trace/logs of the error you’re seeing?
Want results from more Discord servers?
Add your server