Skip to content

[BUG yarn] Failed to prepare server Error: An error occurred while loading the instrumentation hook #971

@BilalJaved15

Description

@BilalJaved15

Describe the bug

THIS IS NOT A DUPLICATE OF THIS ISSUE.

I tried Next JS version 15.4.x with npm as package manager, and it works fine. But when I try it with yarn, it doesn't work and gives the same error as the issue. I tried using pnp and node-modules as nodeLinker, but nothing works. This is my package.json:

{
  "name": "asset-hub",
  "version": "0.1.0",
  "private": true,
  "scripts": {
    "dev": "next dev",
    "build": "next build",
    "start": "next start",
    "lint": "next lint",
    "deploy:dev": "opennextjs-cloudflare build && wrangler deploy --env dev",
    "deploy:prod": "opennextjs-cloudflare build && wrangler deploy --env prod",
    "preview": "opennextjs-cloudflare build && opennextjs-cloudflare preview",
    "cf-typegen": "wrangler types --env-interface CloudflareEnv cloudflare-env.d.ts"
  },
  "dependencies": {
    "@opennextjs/cloudflare": "1.3.0",
    "@shared/constants": "workspace:*",
    "@shared/svg": "workspace:*",
    "@shared/types": "workspace:*",
    "@shared/ui": "workspace:*",
    "@shared/utils": "workspace:*",
    "autoprefixer": "10.4.21",
    "lodash.debounce": "4.0.8",
    "next": "15.4.6",
    "nextjs-toploader": "3.8.16",
    "phosphor-react": "1.4.1",
    "postcss": "8.5.6",
    "react": "19.0.0",
    "react-dom": "19.0.0",
    "react-intl": "7.1.11",
    "react-toastify": "11.0.5"
  },
  "devDependencies": {
    "@cloudflare/workers-types": "4.20250430.0",
    "@eslint/eslintrc": "3",
    "@svgr/webpack": "8.1.0",
    "@tailwindcss/postcss": "4",
    "@types/lodash.debounce": "4",
    "@types/node": "20",
    "@types/react": "19",
    "@types/react-dom": "19",
    "eslint": "9.39.1",
    "eslint-config-next": "15.3.1",
    "tailwindcss": "3.4.4",
    "typescript": "5.2.2",
    "wrangler": "4.45.3"
  }
}

Steps to reproduce

  1. Run this command: yarn create cloudflare@latest -- my-next-app --framework=next --platform=workers
  2. Create everything, it will fail with rclone build error.
  3. Downgrade opennextjs/cloudflare to 1.3.0.
  4. Run yarn install.
  5. Deploy to Cloudflare.
  6. You will get same error:
{
  "message": "Server failed to respond.",
  "details": {}
}

Expected behavior

Next JS Application should work on deployment.

@opennextjs/cloudflare version

1.3.0

Wrangler version

4.45.3

next info output

warn  - Failed to fetch latest canary version. (Reason: Failed to get registry from "yarn"..)
      Detected "15.4.6". Visit https://github.com/vercel/next.js/releases.
      Make sure to try the latest canary version (eg.: `npm install next@canary`) to confirm the issue still exists before creating a new issue.
      
Learn more: https://nextjs.org/docs/messages/opening-an-issue
This project is configured to use yarn because /temp/package.json has a "packageManager" field
This project is configured to use yarn because /temp/package.json has a "packageManager" field

Operating System:
  Platform: darwin
  Arch: arm64
  Version: Darwin Kernel Version 25.0.0: Wed Sep 17 21:41:45 PDT 2025; root:xnu-12377.1.9~141/RELEASE_ARM64_T6000
  Available memory (MB): 16384
  Available CPU cores: 8
Binaries:
  Node: 20.19.5
  npm: 10.8.2
  Yarn: 4.5.0
  pnpm: N/A
Relevant Packages:
  next: 15.4.6
  eslint-config-next: N/A
  react: 19.0.0
  react-dom: 19.0.0
  typescript: 5.2.2
Next.js Config:
  output: N/A

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingtriage

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions