You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Next.js throws an error when hostname and port are not provided in the custom server since v12.0.5-canary.18 — as a result it breaks middleware in Netlify:
// For middleware to "fetch" we must always provide an absolute URLconsturl=getRequestMeta(params.request,'__NEXT_INIT_URL')!if(!url.startsWith('http')){thrownewError('To use middleware you must provide a `hostname` and `port` to the Next.js Server')}
# Paste content of your `next.config.js` file here. Check there is no private info in there.
Builds logs (or link to your logs)
Build logs
# Paste logs here
Function logs
Function logs
# Paste logs here
.next JSON files
generated .next JSON files
# Paste file contents here. Please check there isn't any private info in them
# You can either build locally, or download the deploy from Netlify by clicking the arrow next to the deploy time.
The text was updated successfully, but these errors were encountered:
I have the same issue here but running the server locally. I did an update to version 12.0.8 yesterday and this error started happening. I rollback to 12.0.7 and worked. Maybe there is some bug in the latest version.
Summary
Next.js throws an error when
hostname
andport
are not provided in the custom server since v12.0.5-canary.18 — as a result it breaks middleware in Netlify:[email protected]#L725-L729
Ref: https://github.com/netlify/netlify-plugin-nextjs/blob/main/src/templates/getHandler.ts#L46-L50
Steps to reproduce
npx create-next-app
with one middleware) https://github.com/ivorpad/repro-nextjs-middleware/api/users
___netlify-handler
function logsA link to a reproduction repository
https://github.com/ivorpad/repro-nextjs-middleware
Plugin version
4.2.0
More information about your build
netlify.toml
)What OS are you using?
No response
Your netlify.toml file
`netlify.toml`
Your public/_redirects file
`_redirects`
# Paste content of your `_redirects` file here
Your
next.config.js
file`next.config.js`
# Paste content of your `next.config.js` file here. Check there is no private info in there.
Builds logs (or link to your logs)
Build logs
Function logs
Function logs
.next JSON files
generated .next JSON files
The text was updated successfully, but these errors were encountered: