Next.js Discord

Discord Forum

[TypeError]: The "options.encoding" property must be of type string. Received undefined

Unanswered
Lbcq Florian posted this in #help-forum
Open in Discord
I have built a Webapp using NextJS, Prisma and NextAuth. The application works well on my local machine but when I try to run it in a docker container the login systems failed.

I use BunJS 1.2.9
I am using a very simple credential provider that just require the name of the user.
My env variable seems to be defined in the docker env and in my local env.
This is the error message I obtain in the docker:
 GET /signin 200 in 9272ms
 GET /api/auth/session 200 in 1210ms
 GET /api/auth/providers 200 in 575ms
 GET /api/auth/csrf 200 in 334ms
prisma:query SELECT "public"."User"."id", "public"."User"."name", "public"."User"."email", "public"."User"."emailVerified", "public"."User"."image", "public"."User"."createdAt", "public"."User"."updatedAt" FROM "public"."User" WHERE "public"."User"."name" = $1 LIMIT $2 OFFSET $3
prisma:query SELECT "public"."User"."id", "public"."User"."name", "public"."User"."email", "public"."User"."emailVerified", "public"."User"."image", "public"."User"."createdAt", "public"."User"."updatedAt" FROM "public"."User" WHERE "public"."User"."email" = $1 LIMIT $2 OFFSET $3
 ⨯ Error [TypeError]: The "options.encoding" property must be of type string. Received undefined
    at setAAD (null)
    at processTicksAndRejections (null) {
  code: 'ERR_INVALID_ARG_TYPE',
  toString: [Function: toString]
}
 ⨯ Error [TypeError]: The "options.encoding" property must be of type string. Received undefined
    at setAAD (null)
    at processTicksAndRejections (null) {
  page: '/api/auth/callback/login',
  code: 'ERR_INVALID_ARG_TYPE',
  toString: [Function: toString]
}
 ○ Compiling /_error ...
[BABEL] Note: The code generator has deoptimised the styling of /ORMI-CORE/ormi-app/node_modules/react-dom/cjs/react-dom.development.js as it exceeds the max of 500KB.
 ✓ Compiled /_error in 2.1s

Note that I don't get any noticeable logs on my local machine.

Any idea what could be the cause of this ?

1 Reply

Ok after days of analysis. Using a the latest bun docker image (1.2.9) create an issue withe the node:crypto package. Starting from a node docker and installing bun on top of it fix the issue

https://github.com/oven-sh/bun/issues/18700 (marked as closed but at this time still broken)