Skip to content

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

@Zakisb

Description

@Zakisb

Link to the code that reproduces this issue

https://github.com/Zakisb/aimplifyy

To Reproduce

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

Current vs. Expected behavior

I expected the web app to be deployed. Currently it's crashing
Screenshot 2023-11-07 at 3 56 36 PM
Screenshot 2023-11-07 at 3 56 49 PM

Verify canary release

  • I verified that the issue exists in the latest Next.js canary release

Provide environment information

Operating System:
  Platform: darwin
  Arch: arm64
  Version: Darwin Kernel Version 23.0.0: Fri Sep 15 14:41:34 PDT 2023; root:xnu-10002.1.13~1/RELEASE_ARM64_T8103
Binaries:
  Node: 18.18.0
  npm: 9.8.1
  Yarn: 1.22.11
  pnpm: N/A
Relevant Packages:
  next: 14.0.1
  eslint-config-next: 14.0.0
  react: 18.2.0
  react-dom: 18.2.0
  typescript: 5.2.2
Next.js Config:
  output: N/A

Which area(s) are affected? (Select all that apply)

Middleware / Edge (API routes, runtime)

Additional context

Works fine locally.

Metadata

Metadata

Assignees

No one assigned

    Labels

    RuntimeRelated to Node.js or Edge Runtime with Next.js.bugIssue was opened via the bug report template.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions