blitz-js / next-superjson-plugin

SuperJSON Plugin for Next.js Pages and Components
198 stars 13 forks source link

thread '<unnamed>' panicked at 'failed to register unwind information' #34

Closed ZimM-LostPolygon closed 1 year ago

ZimM-LostPolygon commented 1 year ago

Verify Next.js canary release

Describe the bug

Disclaimer - I wasn't able to verify this bug on next@canary, since switching to it resulted in all kinds of other unrelated issues.

Basically, adding next-superjson-plugin causes the build using npm run build to break. It still works as intended during development. Just making the production build is what fails.

This is the Docker file I use for building:

# Install dependencies only when needed
FROM node:16-alpine AS deps
# Check https://github.com/nodejs/docker-node/tree/b4117f9333da4138b03a546ec926ef50a31506c3#nodealpine to understand why libc6-compat might be needed.
RUN apk add --no-cache libc6-compat
WORKDIR /app

# Install dependencies based on the preferred package manager
COPY package.json yarn.lock* package-lock.json* pnpm-lock.yaml* ./
RUN \
  if [ -f yarn.lock ]; then yarn --frozen-lockfile; \
  elif [ -f package-lock.json ]; then npm ci; \
  elif [ -f pnpm-lock.yaml ]; then yarn global add pnpm && pnpm i; \
  else echo "Lockfile not found." && exit 1; \
  fi

# Rebuild the source code only when needed
FROM node:16-alpine AS builder
WORKDIR /app
COPY --from=deps /app/node_modules ./node_modules
COPY . .

ARG ENV_FILE
COPY ${ENV_FILE} .env.production

# Next.js collects completely anonymous telemetry data about general usage.
# Learn more here: https://nextjs.org/telemetry
# Uncomment the following line in case you want to disable telemetry during the build.
# ENV NEXT_TELEMETRY_DISABLED 1

# RUN yarn build

# If using npm comment out above and use below instead
RUN npm run build

# Production image, copy all the files and run next
FROM node:16-alpine AS runner
WORKDIR /app

ARG NODE_ENV_OVERRIDE
ENV NODE_ENV ${NODE_ENV_OVERRIDE}

# Uncomment the following line in case you want to disable telemetry during runtime.
# ENV NEXT_TELEMETRY_DISABLED 1

RUN addgroup --system --gid 1001 nodejs
RUN adduser --system --uid 1001 nextjs

# You only need to copy next.config.js if you are NOT using the default configuration
COPY --from=builder /app/next.config.js ./
COPY --from=builder /app/public ./public
COPY --from=builder /app/package.json ./package.json

# Automatically leverage output traces to reduce image size
# https://nextjs.org/docs/advanced-features/output-file-tracing
COPY --from=builder --chown=nextjs:nodejs /app/.next/standalone ./
COPY --from=builder --chown=nextjs:nodejs /app/.next/static ./.next/static

USER nextjs

EXPOSE 3000

ENV PORT 3000

CMD ["node", "server.js"]

Expected behavior

The build should not crash.

Reproduction link

No response

Version

NextJS 12.3.1, plugin - 0.4.2

Config

experimental: {
    swcPlugins: [
      [
        'next-superjson-plugin',
        {
          excluded: []
        }
      ]
    ]
  }

Additional context

Full build log:

#16 0.669
#16 0.669 > frontend@0.1.0 build
#16 0.669 > next build
#16 0.669
#16 0.918 info  - Loaded env from /app/.env.production
#16 0.918 info  - Loaded env from /app/.env
#16 1.044 warn  - You have enabled experimental feature (swcPlugins) in next.config.js.
#16 1.044 warn  - Experimental features are not covered by semver, and may cause unexpected or broken application behavior. Use at your own risk.
#16 1.044
#16 1.059 Attention: Next.js now collects completely anonymous telemetry regarding usage.
#16 1.059 This information is used to shape Next.js' roadmap and prioritize features.
#16 1.059 You can learn more, including how to opt-out if you'd not like to participate in this anonymous program, by visiting the following URL:
#16 1.059 https://nextjs.org/telemetry
#16 1.060
#16 1.151 info  - Linting and checking validity of types...
#16 7.073 info  - Creating an optimized production build...
#16 7.965 thread '<unnamed>' panicked at 'failed to register unwind information: "unsupported unwind information"', /root/.cargo/registry/src/github.com-1ecc6299db9ec823/wasmer-engine-universal-2.3.0/src/code_memory.rs:199:18
#16 7.965 note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
#16 8.035 thread '<unnamed>' panicked at 'failed to register unwind information: "unsupported unwind information"', /root/.cargo/registry/src/github.com-1ecc6299db9ec823/wasmer-engine-universal-2.3.0/src/code_memory.rs:199:18
#16 8.049 thread '<unnamed>' panicked at 'failed to register unwind information: "unsupported unwind information"', /root/.cargo/registry/src/github.com-1ecc6299db9ec823/wasmer-engine-universal-2.3.0/src/code_memory.rs:199:18
#16 8.062 thread '<unnamed>' panicked at 'failed to register unwind information: "unsupported unwind information"', /root/.cargo/registry/src/github.com-1ecc6299db9ec823/wasmer-engine-universal-2.3.0/src/code_memory.rs:199:18
#16 8.075 thread '<unnamed>' panicked at 'failed to register unwind information: "unsupported unwind information"', /root/.cargo/registry/src/github.com-1ecc6299db9ec823/wasmer-engine-universal-2.3.0/src/code_memory.rs:199:18
#16 8.088 thread '<unnamed>' panicked at 'failed to register unwind information: "unsupported unwind information"', /root/.cargo/registry/src/github.com-1ecc6299db9ec823/wasmer-engine-universal-2.3.0/src/code_memory.rs:199:18
#16 8.102 thread '<unnamed>' panicked at 'failed to register unwind information: "unsupported unwind information"', /root/.cargo/registry/src/github.com-1ecc6299db9ec823/wasmer-engine-universal-2.3.0/src/code_memory.rs:199:18
#16 8.116 thread '<unnamed>' panicked at 'failed to register unwind information: "unsupported unwind information"', /root/.cargo/registry/src/github.com-1ecc6299db9ec823/wasmer-engine-universal-2.3.0/src/code_memory.rs:199:18
#16 8.130 thread '<unnamed>' panicked at 'failed to register unwind information: "unsupported unwind information"', /root/.cargo/registry/src/github.com-1ecc6299db9ec823/wasmer-engine-universal-2.3.0/src/code_memory.rs:199:18
#16 8.142 thread '<unnamed>' panicked at 'failed to register unwind information: "unsupported unwind information"', /root/.cargo/registry/src/github.com-1ecc6299db9ec823/wasmer-engine-universal-2.3.0/src/code_memory.rs:199:18
#16 8.155 thread '<unnamed>' panicked at 'failed to register unwind information: "unsupported unwind information"', /root/.cargo/registry/src/github.com-1ecc6299db9ec823/wasmer-engine-universal-2.3.0/src/code_memory.rs:199:18
#16 8.409 Failed to compile.
#16 8.409
#16 8.409 ./node_modules/next/dist/pages/_error.js
#16 8.409 Error: failed to process failed to register unwind information: "unsupported unwind information"
#16 8.409
#16 8.409 ./src/pages/_app.tsx
#16 8.409 Error: failed to process failed to register unwind information: "unsupported unwind information"
#16 8.409
#16 8.409 ./src/pages/_document.tsx
#16 8.409 Error: failed to process failed to register unwind information: "unsupported unwind information"
#16 8.409
#16 8.409 ./src/pages/admin/lottery.tsx
#16 8.409 Error: failed to process failed to register unwind information: "unsupported unwind information"
#16 8.409
#16 8.409 ./src/pages/game/[game].tsx
#16 8.409 Error: failed to process failed to register unwind information: "unsupported unwind information"
#16 8.409
#16 8.410
#16 8.410 > Build failed because of webpack errors
#16 8.437 npm notice
#16 8.437 npm notice New minor version of npm available! 8.15.0 -> 8.19.2
#16 8.438 npm notice Changelog: <https://github.com/npm/cli/releases/tag/v8.19.2>
#16 8.438 npm notice Run `npm install -g npm@8.19.2` to update!
#16 8.438 npm notice
orionmiz commented 1 year ago

@ZimM-LostPolygon Failed to reproduce the bug with the dockerfile above.

Would you mind sharing minimal reproduction from the project?

Also, CPU & OS information used to build the docker image would be help too.

joulev commented 1 year ago

Hi, I also face this issue in Next.js v13 (pages directory). The Next.js version is 13.0.6 which is the latest stable version at the time of writing.