next-on-pages icon indicating copy to clipboard operation
next-on-pages copied to clipboard

[๐Ÿ› Bug]: ERROR: A duplicated identifier has been detected in the same function file, aborting.

Open andrepcg opened this issue 1 year ago โ€ข 8 comments

next-on-pages environment related information

System: Platform: linux Arch: x64 Version: #1 SMP Debian 5.10.191-1 (2023-08-16) CPU: (3) x64 Common KVM processor Memory: 5 GB Shell: /usr/bin/zsh Package Manager Used: npm (10.2.4)

Relevant Packages: @cloudflare/next-on-pages: 1.13.4 vercel: N/A next: 13.5.6

Description

After v1.13.4 I started to get ERROR: A duplicated identifier has been detected in the same function file, aborting. Using v1.13.5 still results in the same error.

[email protected] works fine [email protected] doesn't work [email protected] doesn't work

npx vercel build works

Reproduction

No response

Pages Deployment Method

Pages CI (GitHub/GitLab integration)

Pages Deployment ID

27b1a3f7-1fc6-4ba9-8cf2-f291a8509cdf

Additional Information

Dependencies in the project

  "dependencies": {
    "@emotion/react": "^11.11.4",
    "@emotion/styled": "^11.11.0",
    "@meronex/icons": "^4.0.0",
    "@mui/material": "^5.15.14",
    "@sentry/nextjs": "^8.27.0",
    "@sentry/react": "^8.27.0",
    "@themesberg/flowbite": "^1.1.1",
    "@tippyjs/react": "^4.2.6",
    "@weareredlight/denormalize_json_api": "^0.2.2",
    "classnames": "^2.3.1",
    "formik": "^2.2.9",
    "lodash.orderby": "^4.6.0",
    "lodash.throttle": "^4.1.1",
    "next": "^13.5.6",
    "nuka-carousel": "^5.2.0",
    "react": "^18.1.0",
    "react-country-flag": "^3.0.2",
    "react-dom": "^18.1.0",
    "react-onclickoutside": "^6.12.0",
    "react-player": "^2.9.0",
    "react-select-country-list": "^2.2.3",
    "react-social-media-embed": "^2.2.2",
    "react-svg": "^15.0",
    "zustand": "^3.6.5"
  }

Would you like to help?

  • [ ] Would you like to help fixing this bug?

andrepcg avatar Oct 08 '24 11:10 andrepcg

Are you able to share a reproduction for this?

james-elicx avatar Oct 08 '24 11:10 james-elicx

@james-elicx Unfortunately no. My gut feeling is that it is related to using both @sentry/nextjs and @sentry/react packages but I haven't tried it yet, will do it later

andrepcg avatar Oct 08 '24 11:10 andrepcg

@james-elicx Nope, that didnt do anything. Tried to remove a bunch of other packages without success.

What it's clear is that version 1.13.4 introduced the issue. Clear as water

andrepcg avatar Oct 08 '24 18:10 andrepcg

same issue, @cloudflare/next-on-pages v1.13.5 works for me two days ago, but failed today. Revert my lockfile works fine.

My guess is that some dependency upgrade is not compatible with this PR: https://github.com/cloudflare/next-on-pages/pull/886

micooz avatar Oct 31 '24 12:10 micooz

Also seeing this issue after installing @sentry/nextjs

orliesaurus avatar Nov 03 '24 00:11 orliesaurus

Reverting @sentry/nextjs to 8.35.0 fixed that issue for me

kruszczynski avatar Nov 04 '24 11:11 kruszczynski

I also have the same problem with sentry and nextjs. with next-on-pages 1.13.2 I don't have this problem

psincraian avatar Nov 09 '24 20:11 psincraian

I am seeing this on next-on-pages 1.13.6. The duplicated identifier happens to be "26195" and seems to be a small wrapper around node:buffer. E.g. the files in .next almost all have this: {26195:t=>{"use strict";t.exports=require("node:buffer")} ...}

By the time it gets to .vercel/output they tend to all have it defined twice:

E.g. Line 10:

...(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[118],{26195:t=>{"use strict";t.exports=require("node:buffer")}...

Line 142:

...(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[323],{2067:e=>{"use strict";e.exports=require("node:async_hooks")},26195:e=>{"use strict";e.exports=require("node:buffer")},...

Vercel version is "39.1.1". Worth nothing that same version worked fine with next-on-pages 1.13.5 (but I also changed other dependencies, so maybe a fluke).

Can confirm that reverting sentry/nextjs to 8.35.0 from 8.39.0 solves this, and now the reference on line 10 is gone - only the line 142 reference is left.

hitsthings avatar Dec 10 '24 03:12 hitsthings

Hello ๐Ÿ™‚ Thank you for the issue and apologies for the late reply.

Earlier this year we released our Cloudflare adapter for OpenNext, and we have been continuously investing effort in its improvement since then. Existing deployments can continue to use the next-on-pages tooling, but the Cloudflare adapter for OpenNext is currently stable and recommended for deployment of Next.js applications to Cloudflare.

As such, we will no longer be maintaining next-on-pages. We recently deprecated the package on npm and we plan to archive this repo on Monday Sep 29, 2025. In preparation for archival, we are closing all open issues and PRs.

If you have concerns, please feel free to reply here before the repo is archived (after that, it will no longer be possible to comment) or to reach out to our team on Discord.

Thanks so much for using and contributing to next-on-pages ๐Ÿงก

dario-piotrowicz avatar Sep 26 '25 23:09 dario-piotrowicz

Pour one out. ๐Ÿบ

This seems like a perfect crowd to ask: If anyone on this thread has already switched to opennext and has any gotchas to share, especially related to how sentry works on it, I'd love to learn those from you before I do it myself.

hitsthings avatar Sep 26 '25 23:09 hitsthings