workers-sdk icon indicating copy to clipboard operation
workers-sdk copied to clipboard

🐛 BUG: No such module with @cloudflare/vitest-pool-workers

Open ducan-ne opened this issue 2 years ago • 8 comments

Which Cloudflare product(s) does this pertain to?

Workers Vitest Integration

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

0.1.17

What version of Node are you using?

20.12

What operating system and version are you using?

Macos sonoma 14

Describe the Bug

Observed behavior

I'm unable to import module, the error is below

Error: No such module "Users/anduc/projects/bannerify/node_modules/.pnpm/[email protected]/node_modules/satori/dist/parse-css-color".
  imported from "Users/anduc/projects/bannerify/node_modules/.pnpm/[email protected]/node_modules/satori/dist/index.wasm.js"

Note that parse-css-color is a depedencies of satori

Expected behavior

Import package successfully

Steps to reproduce

It raises the error when I import like this

import satori, { init } from 'satori/wasm'

My settings

 poolOptions: {
      workers: {
        miniflare: {
          compatibilityFlags: ['nodejs_compat'],
          compatibilityDate: '2023-12-18',
        },
      },

A git repo we can clone and run a test suit on, or which has a README with step-by-step instructions, is even better. In this case, please use the field below to provide a link to the minimal repro.

Please provide a link to a minimal reproduction

No response

Please provide any relevant error logs

No response

ducan-ne avatar Apr 06 '24 16:04 ducan-ne

Hit this also, I'm using the AWS S3 SDK and trying to write some UTs.

Error: No such module "D:/checkouts/test1/autumn-bread-c1f4/node_modules/@aws-crypto/sha1-browser/build/tslib".
 ❯ node_modules/@aws-crypto/sha1-browser/build/index.js?mf_vitest_no_cjs_esm_shim:4:15

The line it's upset about from the AWS SDK is this:

var tslib_1 = require("tslib");

Looks to me like it's trying to resolve tslib in the wrong place, as per the original post.

aza547 avatar Apr 20 '24 13:04 aza547

Hit this also, I'm using the AWS SnS SDK and trying to write tests:

Error: No such module "Users/rhua/projects/data-tracking-sol-cf-events-worker/node_modules/@aws-sdk/client-sns/node_modules/@aws-crypto/sha256-browser/build/tslib".
 ❯ Users/rhua/projects/data-tracking-sol-cf-events-worker/node_modules/@aws-sdk/client-sns/node_modules/@aws-crypto/sha256-browser/build/index.js?mf_vitest_no_cjs_esm_shim:4:15

ychua avatar Jun 05 '24 05:06 ychua

Having a similar issue with a @wix/sdk library. Import only fails on tests, works well with local and prod environments.

nicolaspapp avatar Jun 15 '24 22:06 nicolaspapp

+1 , seeing same issue on a project.

bstopp avatar Jun 17 '24 16:06 bstopp

+1, same issue here. Would be great if someone from the team could have a look.

psteinroe avatar Jun 25 '24 06:06 psteinroe

Could anyone make a small repro as a git repo so I can have a look? I suspect the latest versions of some packages might resolve this, but would love to see a repro to verify.

threepointone avatar Jun 25 '24 15:06 threepointone

please use [email protected] when making the repro

threepointone avatar Jun 25 '24 15:06 threepointone

Ok this looks to be a good repro https://github.com/cloudflare/workers-sdk/issues/5646#issuecomment-2062193085

threepointone avatar Jun 25 '24 16:06 threepointone

Closing in favour of https://github.com/cloudflare/workers-sdk/issues/5367

penalosa avatar Jul 09 '24 08:07 penalosa