Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ERR_REQUIRE_ESM] in Heroku. Contentful package conflict #1932

Open
EdwardBernal-at opened this issue Dec 4, 2024 · 0 comments
Open

[ERR_REQUIRE_ESM] in Heroku. Contentful package conflict #1932

EdwardBernal-at opened this issue Dec 4, 2024 · 0 comments

Comments

@EdwardBernal-at
Copy link

EdwardBernal-at commented Dec 4, 2024

This might be an isolated case, but I wanted to bring it up in case anyone else is having the same issue. We are still on a previous version of contentful 9.3.5.

Previously we had contentful-export:^7.19.144 in optionalDependencies

Starting with version 7.19.159 we get the below message, which is due to it forcing our app to use contenful:11.1.4. Overriding the version we have in our dependencies.

I''m not quite sure why it happens since contentful-export is declared as an optionalDependency. However this doesn't happen if I move it to devDependencies.

Still investigating the cause on my end, and looking at herokus buildpack as well to see how and why this is happening. I'm leaning towards this being a side effect of heroku-prune

 ⨯ Error [ERR_REQUIRE_ESM]: require() of ES Module /app/node_modules/contentful-sdk-core/dist/index.js from /app/packages/web-app/.next/server/pages/..... not supported.
2024-11-26T18:22:05.584969+00:00 app[web.1]: Instead change the require of index.js in /app/packages/web-app/.next/server/pages/.... to a dynamic import() which is available in all CommonJS modules.
2024-11-26T18:22:05.584970+00:00 app[web.1]:     at mod.require (/app/node_modules/next/dist/server/require-hook.js:65:28)
2024-11-26T18:22:05.584970+00:00 app[web.1]:     at 74421 (/app/packages/web-app/.next/server/pages/.....:15861)
2024-11-26T18:22:05.584971+00:00 app[web.1]:     at o (/app/packages/web-app/.next/server/webpack-runtime.js:1:127)
2024-11-26T18:22:05.584971+00:00 app[web.1]:     at /app/packages/web-app/.next/server/pages/......:1:12800
2024-11-26T18:22:05.584971+00:00 app[web.1]:     at o.a (/app/packages/web-app/.next/server/webpack-runtime.js:1:866) {
2024-11-26T18:22:05.584972+00:00 app[web.1]:   code: 'ERR_REQUIRE_ESM'
2024-11-26T18:22:05.584973+00:00 app[web.1]: }

To clarify; the issue isn't the above error. The issue is the fact its overriding our contentful version in our dependency settings

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant