Open 0-don opened 8 months ago
I have the same issue. It works on 1.0.36.
2024-04-14 14:06:25 error: Cannot find module "@panva/hkdf" from "/usr/src/app/.output/server/node_modules/@auth/core/jwt.js"
2024-04-14 14:06:25 error: script "prod" exited with code 1
2024-04-14 14:06:27 $ bun x prisma migrate deploy && bun .output/server/index.mjs
2024-04-14 14:06:27 error: Cannot find module "@panva/hkdf" from "/usr/src/app/.output/server/node_modules/@auth/core/jwt.js"
2024-04-14 14:06:27 error: script "prod" exited with code 1
2024-04-14 14:06:28 $ bun x prisma migrate deploy && bun .output/server/index.mjs
2024-04-14 14:06:29 error: Cannot find module "@panva/hkdf" from "/usr/src/app/.output/server/node_modules/@auth/core/jwt.js"
2024-04-14 14:06:29 error: script "prod" exited with code 1
2024-04-14 14:06:30 $ bun x prisma migrate deploy && bun .output/server/index.mjs
2024-04-14 14:06:31 error: Cannot find module "@panva/hkdf" from "/usr/src/app/.output/server/node_modules/@auth/core/jwt.js"
2024-04-14 14:06:31 error: script "prod" exited with code 1
2024-04-14 14:06:32 $ bun x prisma migrate deploy && bun .output/server/index.mjs
2024-04-14 14:06:32 error: Cannot find module "@panva/hkdf" from "/usr/src/app/.output/server/node_modules/@auth/core/jwt.js"
2024-04-14 14:06:32 error: script "prod" exited with code 1
2024-04-14 14:06:34 $ bun x prisma migrate deploy && bun .output/server/index.mjs
2024-04-14 14:06:35 error: Cannot find module "@panva/hkdf" from "/usr/src/app/.output/server/node_modules/@auth/core/jwt.js"
2024-04-14 14:06:35 error: script "prod" exited with code 1
any updates on this issue? I am still staying on 1.0.36
and failed to upgrade to the latest.
yeah waiting aswell
the issue continues on v1.1.7
the issue still continue on v1.1.12. any updates on this?
yes me to
I found out the reason for the issue. It seems that the latest Bun version is causing the build engine to miss tracking the dependency for the @panva/hkdf
module, leaving only the web version of the code on the server side when using Bun versions later than 1.0.36.
To fix this, we need to move @panva/hkdf/dist/node/esm/
to the final build folder.
Here's the relevant section from the package.json
of @panva/hkdf
:
"exports": {
".": {
"types": "./dist/types/index.d.ts",
"browser": "./dist/web/index.js",
"worker": "./dist/web/index.js",
"import": "./dist/node/esm/index.js",
"require": "./dist/node/cjs/index.js"
},
"./package.json": "./package.json"
}
If you are using Nuxt, you can add the following to your nuxt.config.ts
:
build: {
transpile: [
'@auth/core',
'@panva/hkdf'
]
}
This should ensure that the correct node version is included in the build, resolving the issue.
I have similar issue with different package name. building and running it using nodejs is working
this error only appears with bun and I think this because of @authjs/core library, i'm not sure
bun i && bun --bun run build && bun --bun .output/server/index.mjs
Listening on http://[::]:3000
[nuxt] [request error] [unhandled] [500] Cannot find package "jose" from ".output/server/chunks/routes/api/auth/_..._.mjs"
at new H3Error (./.output/server/chunks/runtime.mjs:1922:4)
at createError$1 (./.output/server/chunks/runtime.mjs:1955:26)
at <anonymous> (./.output/server/chunks/runtime.mjs:3420:25)
at processTicksAndRejections (:12:39)
export default defineNuxtConfig({
build: {
transpile: ["@auth/core", "@panva/hkdf"],
},
authJs: {
// authenticatedRedirectTo: "/projects",
// guestRedirectTo: "/",
baseUrl: process.env.AUTH_ORIGIN,
},
alias: {
cookie: "cookie",
},...
I am using solid start doesnt seem to work there
confirm the issue still exists in the latest bun version.
What version of Bun is running?
1.1.0+5903a6141
What platform is your computer?
Linux 6.8.2-arch2-1 x86_64
What steps can reproduce the bug?
I am using solid-start nextauth and running the bun app in docker container which produces this error
What is the expected behavior?
it works in the previous bun version 1.0.36
What do you see instead?
it works in the previous bun version 1.0.36
Additional information
No response