Skip to content

🐛 BUG: vitest-pool-workers node compatibility with the jose and prisma libraries #5127

Closed
@vladinator1000

Description

@vladinator1000

Which Cloudflare product(s) does this pertain to?

Wrangler core

What version(s) of the tool(s) are you using?

3.30.1

What version of Node are you using?

v21.6.1

What operating system and version are you using?

Windows 11

Describe the Bug

Observed behavior

When I run the tests in my repro

npm run test

I observe this error

 src/jwt.test.ts [ src/jwt.test.ts ]
TypeError: deprecate is not a function
 ❯ node_modules/jose/dist/node/esm/runtime/rsaes.js:23:38

The jose library actually works in the production runtime of Cloudflare workers, without the nodejs_compat flag, but vitest-pool-workers paradoxically requires the flag.

Expected behavior

The tests work.

Steps to reproduce

Clone https://github.com/vladinator1000/miniflare-node-compat-bug

Run

npm i
npm run test

Please provide a link to a minimal reproduction

https://github.com/vladinator1000/miniflare-node-compat-bug

Please provide any relevant error logs

 src/jwt.test.ts [ src/jwt.test.ts ]
TypeError: deprecate is not a function
 ❯ node_modules/jose/dist/node/esm/runtime/rsaes.js:23:38

I also found a similar issue when using Prisma: prisma/prisma#23193 (comment)

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething that isn't working

    Type

    No type

    Projects

    Status

    Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions