Closed jmgunter closed 2 months ago
I'm having a similar issue with a setup that worked just fine until now:
> npx tsx seed.ts
<project>/node_modules/.pnpm/fictional@2.0.2/node_modules/fictional/hash.js:7
var generateKey = siphash.string16_to_key.bind(siphash)
^
TypeError: Cannot read properties of undefined (reading 'bind')
at Object.<anonymous> (<project>/node_modules/.pnpm/fictional@2.0.2/node_modules/fictional/hash.js:7:43)
at Module._compile (node:internal/modules/cjs/loader:1358:14)
at Object.transformer (/Users/xxx/.npm/_npx/fd45a72a545557e9/node_modules/tsx/dist/register-DxMxtvGN.cjs:2:1122)
at Module.load (node:internal/modules/cjs/loader:1208:32)
at Module._load (node:internal/modules/cjs/loader:1024:12)
at Module.require (node:internal/modules/cjs/loader:1233:19)
at require (node:internal/modules/helpers:179:18)
at Object.<anonymous> (<project>/node_modules/.pnpm/fictional@2.0.2/node_modules/fictional/index.js:1:16)
at Module._compile (node:internal/modules/cjs/loader:1358:14)
at Object.transformer (/Users/xxx/.npm/_npx/fd45a72a545557e9/node_modules/tsx/dist/register-DxMxtvGN.cjs:2:1122)
Node.js v20.15.1
ELIFECYCLE Command failed with exit code 1.
This happens on import, even if I have nothing else in seed.ts
. Just import { createSeedClient } from '@snaplet/seed'
causes the error.
I rolled back the snaplet version, and even the entire project, but I always get this error. I'm baffled to why?
I am having the same issue and it has all worked until this morning. I wonder if it has something to do with Snaplet shutting down?
Same issue here.
Since the error comes from the fictional package, I also opened an issue over there: https://github.com/oftherivier/fictional/issues/39
Since fictional didn't change most recently, I'm not sure why the error comes up now. Maybe it's ESM module related?
Also having this issue. Currently using the Prisma adapter. Previously working seeding is now broken, and I also tried it with the default test user example and both are throwing this exact same error in OP.
Having a similar issue (reading 'trim')...
Fixed by using: pnpm dlx @snaplet/seed@0.97.20 generate
For me the issue turned out to be the latest release of tsx. Running npx tsx@4.16.2 seed.ts works.
Using latest tsx seems to solve the issue.
I tested with:
npx tsx --version
tsx v4.16.4
node v22.5.1
Will close issue soon if no more comment
It works with tsx@4.16.2
, thank you @jmgunter for finding this workaround!
@CarelFdeWaal I'm still getting the same error using the latest tsx
.
❯ npx tsx --version
tsx v4.16.4
node v22.4.1
It seems the root cause for the issue has been identified upstream, and hopefully can be solved there: https://github.com/oftherivier/fictional/issues/39
Thank you for looking into this! And thank you for this great project!
The upstream issue has been solved, things should work again without a workaround.
I had to reinstall all modules with pnpm
after deleting the lock file and the node_modules
folder to ensure the version of fictional
that fixes the issue is in the dependencies.
A new installation of @snaplet/seed in my typescript project is now throwing this error when running
npx tsx seed.ts
My seed.ts file: