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

500 Error with Next-intl Middleware on Vercel Deployment: EDGE_FUNCTION_INVOCATION_FAILED #603

Closed
Zakisb opened this issue Nov 7, 2023 · 8 comments
Labels
bug Something isn't working unconfirmed Needs triage.

Comments

@Zakisb
Copy link

Zakisb commented Nov 7, 2023

Description

Encountering a server-side error when deploying a Next.js 14 application with next-intl middleware to Vercel. The deployment fails with a 500 status code, specifically citing EDGE_FUNCTION_INVOCATION_FAILED as the reason. Additionally, a ReferenceError: __dirname is not defined occurs within the ua-parser-js module, as well as in the user-agent and middleware files of next-intl. This error is not present during local development and only manifests upon deployment to Vercel.

Note that previously i worked with next-intl and deployed without a problem. i don't know if it's something to do with the latest next 14 version or next-intl

Mandatory reproduction URL (CodeSandbox or GitHub repository)

https://github.com/Zakisb/aimplifyy

Reproduction description

Deploy to vercel

Expected behaviour

I expected the web app to be deployed.

@Zakisb Zakisb added bug Something isn't working unconfirmed Needs triage. labels Nov 7, 2023
@amannn
Copy link
Owner

amannn commented Nov 7, 2023

Can you upgrade to the release candidate and see if the issue persists? The examples in this repo have been updated to Next.js 14 and can be deployed to Vercel flawlessly.

@Zakisb
Copy link
Author

Zakisb commented Nov 7, 2023

Now during the build i'm getting this error
Error [ERR_PACKAGE_PATH_NOT_EXPORTED]: Package subpath './plugin' is not defined by "exports" in /Users/zakisb/Desktop/aimplifyy/node_modules/next-intl/package.json

@amannn
Copy link
Owner

amannn commented Nov 7, 2023

You're using the stable version, not the release candidate.

https://github.com/Zakisb/aimplifyy/blob/32173189db4e9b8c0ba107ea6db1b65fd2c62eb4/package.json#L22

@Zakisb
Copy link
Author

Zakisb commented Nov 7, 2023

Updated. now i'm getting this as error
Screenshot 2023-11-07 at 7 28 17 PM

@Zakisb
Copy link
Author

Zakisb commented Nov 7, 2023

Still the same problem
ReferenceError: __dirname is not defined
at (node_modules/next/dist/compiled/ua-parser-js/ua-parser.js:1:17315)
at (node_modules/next/dist/compiled/ua-parser-js/ua-parser.js:1:17444)
at (node_modules/next/dist/server/web/spec-extension/user-agent.js:27:59)
at (node_modules/next/server.js:8:0)
at (node_modules/next-intl/dist/production/middleware/middleware.js:1:68)
at (node_modules/next-intl/dist/production/middleware.js:1:68)
it's insane.... is there a way to provide a clear middleware in the docs please?

@amannn
Copy link
Owner

amannn commented Nov 7, 2023

Updated. now i'm getting this as error

The latest release candidate is next-intl@3.0.0-rc.9, as mentioned at the bottom of https://next-intl-docs.vercel.app/blog/next-intl-3-0. getTranslations was introduced only recently.

@Zakisb
Copy link
Author

Zakisb commented Nov 7, 2023

Screenshot 2023-11-07 at 8 33 14 PM
In the build logs, i'm getting this warning. i think that's what's causing the error. sorry if that's a dumb question but is it because i'm not using typescript?

@amannn
Copy link
Owner

amannn commented Nov 7, 2023

I unfortunately don't have any background on that warning, but it shouldn't be related to the usage of JavaScript.

I'll close this issue since there doesn't seem to be an issue with next-intl, I hope you understand.

@amannn amannn closed this as completed Nov 7, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working unconfirmed Needs triage.
Projects
None yet
Development

No branches or pull requests

2 participants