Docker crash when loading gifs with Next Image (`TypeError: request.endsWith is not a function`)
Answered
Ocicat posted this in #help-forum
OcicatOP
In Docker + Next.js, certain requests are causing
This problem does not occur in development (
500 Internal Server Error for URLs with RSC URL params attached (e.g. http://<APP_URL>?_rsc=1syi9). Eventually, the app crashes with the following output:// ⨯ 57 | }).bind(null, resolveFilename, hookPropertyMap);
// 58 | // This is a hack to make sure that if a user requires a Next.js module that wasn't bundled
// 59 | // that needs to point to the rendering runtime version, it will point to the correct one.
// 60 | // This can happen on `pages` when a user requires a dependency that uses next/image for example.
// 61 | mod.prototype.require = function(request) {
// 62 | if (request.endsWith(".shared-runtime")) {
// ^
// TypeError: request.endsWith is not a function. (In 'request.endsWith(".shared-runtime")', 'request.endsWith' is undefined)
// at /app/node_modules/next/dist/server/require-hook.js:62:9
// at getMiddleware (/app/node_modules/next/dist/server/next-server.js:915:26)
// at /app/node_modules/next/dist/server/base-server.js:173:32
// at /app/node_modules/next/dist/server/base-server.js:172:50
// at /app/node_modules/next/dist/server/base-server.js:275:34This problem does not occur in development (
next dev) nor with next build && next start outside of DockerAnswered by Ocicat
Fixed, issue is caused by bun runtime. Switching to node runtime works
2 Replies
OcicatOP
I discovered that it is only when a gif is loaded with Next Image
OcicatOP
Fixed, issue is caused by bun runtime. Switching to node runtime works
Answer