-
Notifications
You must be signed in to change notification settings - Fork 27.2k
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
Upload file API stopped working - middleware issue #39380
Comments
I have // middleware.ts
import type { NextRequest } from 'next/server'
import { NextResponse } from 'next/server'
// https://nextjs.org/docs/messages/middleware-upgrade-guide
const PUBLIC_FILE = /\.(.*)$/
// eslint-disable-next-line @typescript-eslint/no-unused-vars
export function middleware(request: NextRequest) {
const shouldHandleLocale =
!PUBLIC_FILE.test(request.nextUrl.pathname) &&
!request.nextUrl.pathname.includes('/api/') &&
request.nextUrl.locale === 'default'
return shouldHandleLocale
? NextResponse.redirect(`/en${request.nextUrl.href}`)
: undefined
} |
maybe related to #39262 |
It happens exactly the same to me! |
In my case I have the same issue |
I have the same exact issue |
Same here |
I have the same problem with a POST request with a payload of 50Kb Edit: export const config = {
matcher: '/((?!api\/).*)',
} |
It should be works now. Check: #36497 (comment) 🙂 |
This closed issue has been automatically locked because it had no new activity for a month. If you are running into a similar issue, please create a new issue with the steps to reproduce. Thank you. |
Verify canary release
Provide environment information
What browser are you using? (if relevant)
No response
How are you deploying your application? (if relevant)
No response
Describe the Bug
Simply the API to upload the file stopped working.
The request hangs and there is no response
The request does not reach the breakpoint on the API line 81
if (!request.file) {
when I remove the
form-data
params the API is called and of course, I getFile was not provided
Expected Behavior
It should just work like before
Link to reproduction
/
To Reproduce
To reproduce here the API upload.tsx
The text was updated successfully, but these errors were encountered: