This repository was archived by the owner on Sep 29, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 165
This repository was archived by the owner on Sep 29, 2025. It is now read-only.
[🐛 Bug]: Incompatible with Next.js instrumentation #678
Copy link
Copy link
Closed as not planned
Labels
bugSomething isn't workingSomething isn't working
Description
next-on-pages environment related information
System:
Platform: darwin
Arch: arm64
Version: Darwin Kernel Version 23.2.0: Wed Nov 15 21:55:06 PST 2023; root:xnu-10002.61.3~2/RELEASE_ARM64_T6020
CPU: (12) arm64 Apple M2 Max
Memory: 64 GB
Shell: /bin/zsh
Package Manager Used: npm (9.8.1)
Relevant Packages:
@cloudflare/next-on-pages: 1.9.0
vercel: 33.5.2
next: 14.1.0
Description
next-on-pages breaks when using Next's default instrumentation @vercel/otel, resulting in the following error:
... rest of next build
⚡️ Completed `npx vercel build`.
⚡️ ERROR: A duplicated identifier has been detected in the same function file, aborting.
⚡️ Please report this at https://github.com/cloudflare/next-on-pages/issues.
Reproduction
Steps to reproduce:
- Create a new project with
npm create cloudflare@latest next-on-pages -- --framework=next - Install
@vercel/otel(npm install @vercel/otel) - Add
experimental: { instrumentationHook: true }to your next config - Create a new file in the
srcor root of the project calledinstrumentation.ts - Paste the following contents:
// src/instrumentation.ts
import { registerOTel } from "@vercel/otel"
export function register() {
registerOTel()
}- Build with
npx next-on-pages
Pages Deployment Method
None
Pages Deployment ID
No response
Additional Information
The error seems to happen in this function, but I'm not sure why.
A few notes:
- Calling
registerOTelis not required. Simply printing it (console.log(registerOTel)) is enough to cause the error - Vercel made the repo private, so I can't inspect the code https://github.com/vercel/otel
- The code that they ship is minified
- They say that you can use OTEL's libraries directly but it only works with Node. To use with edge you have to use their library
Would you like to help?
- Would you like to help fixing this bug?
ostenbom, fredriknils, jan-acemate, cjxe, chalkygames123 and 9 more
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working