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

Vercel preset + edge middleware , sets 404 to /api/* endpoints #477

Closed
Yegaston opened this issue Sep 6, 2022 · 1 comment
Closed

Vercel preset + edge middleware , sets 404 to /api/* endpoints #477

Yegaston opened this issue Sep 6, 2022 · 1 comment
Labels
bug Something isn't working preset:vercel-edge

Comments

@Yegaston
Copy link

Yegaston commented Sep 6, 2022

Environment

Operating System: macOs 12.5.1 (21G83)
Node Version: v16.11.1
Nuxt Version: 3.0.0-rc.6
Package Manager: npm@6.14.15
Builder: vite

Reproduction

https://stackblitz.com/edit/github-usfnbu

Describe the bug

If a middleware.ts file is created in the root of the project to use vercel's edge middleware, the config.json file that nitro generates sends to 404 to all /api/* endpoints
For example:

{
  "version": 3,
  "routes": [
    {
      "src": "/_nuxt(.*)",
      "headers": {
        "cache-control": "public,max-age=31536000,immutable"
      },
      "continue": true
    },
    {
      "handle": "error"
    },
    {
      "status": 404,
      "src": "^(?!/api).*$",
      "dest": "/404.html"
    },
    {
      "handle": "filesystem"
    },
    {
      "src": "/(.*)",
      "dest": "/"
    }
  ]
}

But if not have that middleware.ts file, the build not generates this exeception to api endpoints

Additional context

No response

Logs

No response

@Hebilicious Hebilicious added bug Something isn't working preset:vercel-edge labels Jul 1, 2023 — with Volta.net
@pi0
Copy link
Member

pi0 commented May 16, 2024

When using nitro, please consider exclusively using server/ directory to avoid such conflicts.

@pi0 pi0 closed this as not planned Won't fix, can't repro, duplicate, stale May 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working preset:vercel-edge
Projects
None yet
Development

No branches or pull requests

3 participants