Skip to content

compilePackages: next/server NextResponse.json() segfaults (SIGSEGV) #5199

@proggeramlug

Description

@proggeramlug

Perry: origin/main @ a1d9ce6 (v0.5.1174) · macOS arm64
Setup: next in perry.compilePackages + perry.allow.compilePackages: ["*"]; default (auto-optimize) build.

Bug

next/server's NextResponse.json(...) segfaults (SIGSEGV / exit 139). Narrowing:

  • import { NextResponse } from 'next/server'; console.log(typeof NextResponse) → prints function, exit 0 ✅ (import + symbol resolution work)
  • NextResponse.json({ ... }, { status })SIGSEGV before any further use (no .text()/.status needed)

NextResponse extends the web Response; the crash is in constructing the JSON response.

Repro

import { NextResponse } from 'next/server';
const res = NextResponse.json({ ok: true, n: 42 }, { status: 201 });
console.log("created", res.status);

Expected

A Response with status === 201 (no Node strip-types baseline — next/server needs a bundler to run under Node; expected per the web/Next API).

Actual (Perry)

(no output; SIGSEGV / exit 139)

Two non-fatal warnings also emit during compile (likely related coverage gaps): Could not resolve import 'next/dist/compiled/ua-parser-js' from user-agent.js.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions