GithubHelp home page GithubHelp logo

Comments (7)

Jarred-Sumner avatar Jarred-Sumner commented on June 2, 2024 2

This is fixed in Bun v1.0.30 which releases in about an hour

In the meantime, you can upgrade with bun upgrade --canary

from bun.

Electroid avatar Electroid commented on June 2, 2024

Would it be possible to share a minimal repro? Also if you could describe how many requests you're sending before you experience this error? (or if the error always occurs)

from bun.

felipemullen avatar felipemullen commented on June 2, 2024

I just started seeing this issue in an existing site that was fine for the last few months up until this week. Not sure yet what is causing it, but if I find out I will update this ticket

from bun.

Jarred-Sumner avatar Jarred-Sumner commented on June 2, 2024

It sounds like something is passing undefined to require. The question is what/why

from bun.

felipemullen avatar felipemullen commented on June 2, 2024

Restarting my docker container fixed this (no rebuild), which is not a great answer or workaround. I am not sure how to reproduce it at this point, but for context, here is my dockerfile:

FROM imbios/bun-node:18-slim AS base
ARG DEBIAN_FRONTEND=noninteractive

FROM base AS deps
WORKDIR /app

COPY package.json bun.lockb ./
RUN bun install

FROM base AS builder
WORKDIR /app
COPY --from=deps /app/node_modules ./node_modules
COPY . .

ENV NEXT_TELEMETRY_DISABLED 1
RUN bun run build

FROM base AS runner
WORKDIR /app

ENV NODE_ENV production
ENV NEXT_TELEMETRY_DISABLED 1

COPY --from=builder /app/public ./public

RUN mkdir .next
COPY --from=builder /app/.next/standalone ./
COPY --from=builder /app/.next/static ./.next/static

RUN chmod +x /usr/local/bin/docker-entrypoint.sh

ENV PORT 3000
EXPOSE 3000
ENV HOSTNAME "0.0.0.0"

CMD ["bun", "run", "server.js"]

If I encounter the issue again, I will try to enter the container to see if I find anything else.

Open for full stack trace
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 getEdgeFunctionsPages (/app/node_modules/next/dist/server/next-server.js:926:26)
      at /app/node_modules/next/dist/server/next-server.js:885:17
      at renderErrorToResponseImpl (/app/node_modules/next/dist/server/next-server.js:873:37)
      at /app/node_modules/next/dist/server/base-server.js:2001:107
      at renderErrorToResponse (/app/node_modules/next/dist/server/base-server.js:2000:33)
      at /app/node_modules/next/dist/server/base-server.js:1988:36
      at /app/node_modules/next/dist/server/base-server.js:1987:33
      at /app/node_modules/next/dist/server/base-server.js:911:31
      at pipeImpl (/app/node_modules/next/dist/server/base-server.js:901:24)
      at /app/node_modules/next/dist/server/base-server.js:899:123
      at pipe (/app/node_modules/next/dist/server/base-server.js:898:20)
      at renderErrorImpl (/app/node_modules/next/dist/server/base-server.js:1983:27)
      at /app/node_modules/next/dist/server/base-server.js:1979:97
      at renderError (/app/node_modules/next/dist/server/base-server.js:1978:23)
      at renderError (/app/node_modules/next/dist/server/next-server.js:899:23)
      at /app/node_modules/next/dist/server/base-server.js:777:28

from bun.

Fuchsoria avatar Fuchsoria commented on June 2, 2024

Have same issue with nextjs 14.1, added guards patch but at the end it goes deeper into errors
patch:
if (request && typeof request === "object" && request.endsWith(".shared-runtime")) { return originalRequire.call(this,next/dist/server/future/route-modules/pages/vendored/contexts/${path.basename(request, ".shared-runtime")}); } return originalRequire.call(this, request);

image

from bun.

GeitV avatar GeitV commented on June 2, 2024

We are getting this error as well, when running NextJS app with bun in docker. We are using custom API endpoint for K8S to do health check against pod and so this error happens as soon as the app deploys.

Our workaround was to run the app using nodejs in the meantime.

from bun.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.