v4 beta release #706
Replies: 48 comments 227 replies
-
Hey team - chiming in to see if this might help sort out a build issue which is plaguing an update to my site this weekend. Builds are failing due to some mysterious webpack errors, which only seems to be happening when I ran Locally, builds are running fine (with Anything else I can do to help debug here? I'd love to get my site building! edit: getting deeper in the weeds on this... |
Beta Was this translation helpful? Give feedback.
-
I just upgraded and it reduced my build time by a ton which is awesome but it seems like my api function for a sanity preview no longer work. It build and deploys fine but my /api/preview doesn't realize any query params are given. `const Preview = async (req: NextApiRequest, res: NextApiResponse): Promise => { // Check the secret and next parameters // Enable Preview Mode by setting the cookies // Redirect to the path from the fetched post return res.end(); export default Preview;` Not entirely sure what is wrong either any help would be appreciated. Thanks, |
Beta Was this translation helpful? Give feedback.
-
Build succeeded, but my site isn't working with the beta: {
"errorType": "Error",
"errorMessage": "Could not find Next.js server",
"trace": [
"Error: Could not find Next.js server",
" at /var/task/.netlify/functions-internal/___netlify-handler/___netlify-handler.js:30:19",
" at Object.<anonymous> (/var/task/.netlify/functions-internal/___netlify-handler/___netlify-handler.js:75:3)",
" at Module._compile (internal/modules/cjs/loader.js:999:30)",
" at Object.Module._extensions..js (internal/modules/cjs/loader.js:1027:10)",
" at Module.load (internal/modules/cjs/loader.js:863:32)",
" at Function.Module._load (internal/modules/cjs/loader.js:708:14)",
" at Module.require (internal/modules/cjs/loader.js:887:19)",
" at require (internal/modules/cjs/helpers.js:74:18)",
" at Object.<anonymous> (/var/task/___netlify-handler.js:1:18)",
" at Module._compile (internal/modules/cjs/loader.js:999:30)"
]
} |
Beta Was this translation helpful? Give feedback.
-
When using v4, do we need this section of Netlify.toml?
We had added this to solve some build errors on the site, found it looking at some Github issues. Should it still be present with the rewrite? |
Beta Was this translation helpful? Give feedback.
-
@lindsaylevine It's me again! lol Super awesome rewrite, deploy time was cut in half. I tried to deploy this out: Not sure I can send you a reproduction though. :(
|
Beta Was this translation helpful? Give feedback.
-
Hi folks. I have found the following scenario where URLs without trailing slashes are not handled as expected by the on-demand builders
This does not effect users navigating the site, because |
Beta Was this translation helpful? Give feedback.
-
Hi all, tried the
netlify.toml
next.config.js module.exports = {
distDir: ".next",
}; Would be grateful for any tips on how to get past it! 🙏 |
Beta Was this translation helpful? Give feedback.
-
Yes, that would do it! I'm working on better tools to diagnose these issues and automatically exclude more |
Beta Was this translation helpful? Give feedback.
-
This fixed failing builds (came up recently, no change in my code, just static content updates) due to function sizes being too big. Also went for ~9 deployed functions to ~3 for some reason? No known issues yet but I really needed to just get the site out there before it got too stale. I sure hope this all works as the previous build setups were a real mess to work with. |
Beta Was this translation helpful? Give feedback.
-
Hi gang, thanks for your help earlier! I'm back with another potential bug to generate a sitemap.xml file for my site - this plugin seems to affect I added a postbuild to my site in this PR - Netlify seems to skip or otherwise ignore the
again, comparing the same setup to vercel's deploy process - my sitemap.xml is available: |
Beta Was this translation helpful? Give feedback.
-
Just chiming in here to say that switching to the v4 beta seems to have resolved some weird issues I was seeing with dynamic routes+getStaticPaths+getStaticProps (where some of the application runtime code seemed to just not be loaded at all). So, thanks! |
Beta Was this translation helpful? Give feedback.
-
Hi all, I might have missed this, but is there actually a changelog somewhere with everything that was updated in v4? Mainly hoping that full ISR with fallbacks made it into this beta |
Beta Was this translation helpful? Give feedback.
-
This was working great for me last week, but I'm now getting the following error:
The build actually "succeeds" in the Netlify UI, but when I visit the deploy URL, I get that error. |
Beta Was this translation helpful? Give feedback.
-
Just started seeing 503s on deploy previews for my site using this plugin. 4.0.0-beta.2. Was fine a couple hours ago. |
Beta Was this translation helpful? Give feedback.
-
Not expecting anything crazy. But with NextJS 12 just announced, do we expect this rewrite to work to support NextJS 12 right now or after some new work is done? |
Beta Was this translation helpful? Give feedback.
-
edit: related code is in this PR Hey there - I'm trying to implement a My current strategy is to look through the
This runs fine locally in dev, and when deployed on Vercel, but when I deploy to netlify, I'm seeing an error in
In my case, I'm using an API Route at module.exports = {
// ...
rewrites: async () => [
{
source: '/sitemap.xml',
destination: '/api/sitemap.xml',
},
],
}; I'm wondering if there's something tricky going on here because of how functions are deployed. Any guesses if this might be related to this plugin? Note that this appears to be broken even if I visit the non-redirected page /api/sitemap.xml |
Beta Was this translation helpful? Give feedback.
-
I also have issues running the my Toml file: [build]
publish = ".next"
[[plugins]]
package = "@netlify/plugin-nextjs"
package.json "@netlify/plugin-nextjs": "^4.0.0-beta.6", This is the error I'm getting: ────────────────────────────────────────────────────────────────
4. @netlify/plugin-nextjs (onEnd event)
────────────────────────────────────────────────────────────────
Thank you for trying the Essential Next.js beta plugin.
Please share feedback (both good and bad) at https://ntl.fyi/next-beta-feedback
(@netlify/plugin-nextjs onEnd completed in 198ms)
────────────────────────────────────────────────────────────────
Dependencies installation error
────────────────────────────────────────────────────────────────
Error message
A Netlify Function failed to require one of its dependencies.
Please make sure it is present in the site's top-level "package.json".
In file "/Users/aliparandeh/Documents/Github/BYAI/platform/.netlify/functions-internal/next_api_checkout_session/next_api_checkout_session.js"
Cannot find module 'webpack'
Require stack:
- /Users/aliparandeh/.nvm/versions/node/v14.15.1/lib/node_modules/netlify-cli/node_modules/@netlify/zip-it-and-ship-it/dist/runtimes/node/bundlers/zisi/resolve.js
- /Users/aliparandeh/.nvm/versions/node/v14.15.1/lib/node_modules/netlify-cli/node_modules/@netlify/zip-it-and-ship-it/dist/runtimes/node/bundlers/zisi/traverse.js
- /Users/aliparandeh/.nvm/versions/node/v14.15.1/lib/node_modules/netlify-cli/node_modules/@netlify/zip-it-and-ship-it/dist/runtimes/node/bundlers/esbuild/src_files.js
- /Users/aliparandeh/.nvm/versions/node/v14.15.1/lib/node_modules/netlify-cli/node_modules/@netlify/zip-it-and-ship-it/dist/runtimes/node/bundlers/esbuild/index.js
- /Users/aliparandeh/.nvm/versions/node/v14.15.1/lib/node_modules/netlify-cli/node_modules/@netlify/zip-it-and-ship-it/dist/runtimes/node/bundlers/index.js
- /Users/aliparandeh/.nvm/versions/node/v14.15.1/lib/node_modules/netlify-cli/node_modules/@netlify/zip-it-and-ship-it/dist/runtimes/node/index.js
- /Users/aliparandeh/.nvm/versions/node/v14.15.1/lib/node_modules/netlify-cli/node_modules/@netlify/zip-it-and-ship-it/dist/runtimes/index.js
- /Users/aliparandeh/.nvm/versions/node/v14.15.1/lib/node_modules/netlify-cli/node_modules/@netlify/zip-it-and-ship-it/dist/main.js
- /Users/aliparandeh/.nvm/versions/node/v14.15.1/lib/node_modules/netlify-cli/node_modules/@netlify/build/src/plugins_core/functions/index.js
- /Users/aliparandeh/.nvm/versions/node/v14.15.1/lib/node_modules/netlify-cli/node_modules/@netlify/build/src/steps/get.js
- /Users/aliparandeh/.nvm/versions/node/v14.15.1/lib/node_modules/netlify-cli/node_modules/@netlify/build/src/core/main.js
- /Users/aliparandeh/.nvm/versions/node/v14.15.1/lib/node_modules/netlify-cli/src/lib/build.js
- /Users/aliparandeh/.nvm/versions/node/v14.15.1/lib/node_modules/netlify-cli/src/commands/build/index.js
- /Users/aliparandeh/.nvm/versions/node/v14.15.1/lib/node_modules/netlify-cli/node_modules/@oclif/config/lib/plugin.js
- /Users/aliparandeh/.nvm/versions/node/v14.15.1/lib/node_modules/netlify-cli/node_modules/@oclif/config/lib/config.js
- /Users/aliparandeh/.nvm/versions/node/v14.15.1/lib/node_modules/netlify-cli/node_modules/@oclif/config/lib/index.js
- /Users/aliparandeh/.nvm/versions/node/v14.15.1/lib/node_modules/netlify-cli/node_modules/@oclif/command/lib/command.js
- /Users/aliparandeh/.nvm/versions/node/v14.15.1/lib/node_modules/netlify-cli/node_modules/@oclif/command/lib/index.js
- /Users/aliparandeh/.nvm/versions/node/v14.15.1/lib/node_modules/netlify-cli/src/index.js
- /Users/aliparandeh/.nvm/versions/node/v14.15.1/lib/node_modules/netlify-cli/bin/run
Resolved config
build:
environment:
- NEXT_PRIVATE_TARGET
publish: /Users/aliparandeh/Documents/Github/BYAI/platform/.next
publishOrigin: config
functions:
___netlify-handler:
external_node_modules: []
included_files:
- .next/server/**
- .next/serverless/**
- .next/*.json
- .next/BUILD_ID
- .next/static/chunks/webpack-middleware*.js
- '!.next/server/**/*.js.nft.json'
- '!node_modules/next/dist/compiled/@ampproject/toolbox-optimizer/**/*'
- '!node_modules/next/dist/server/lib/squoosh/**/*.wasm'
- '!node_modules/next/dist/next-server/server/lib/squoosh/**/*.wasm'
- '!node_modules/next/dist/compiled/webpack/bundle4.js'
- '!node_modules/next/dist/compiled/webpack/bundle5.js'
- '!node_modules/next/dist/compiled/terser/bundle.min.js'
- '!node_modules/sharp/**/*'
node_bundler: nft
___netlify-odb-handler:
external_node_modules: []
included_files:
- .next/server/**
- .next/serverless/**
- .next/*.json
- .next/BUILD_ID
- .next/static/chunks/webpack-middleware*.js
- '!.next/server/**/*.js.nft.json'
- '!node_modules/next/dist/compiled/@ampproject/toolbox-optimizer/**/*'
- '!node_modules/next/dist/server/lib/squoosh/**/*.wasm'
- '!node_modules/next/dist/next-server/server/lib/squoosh/**/*.wasm'
- '!node_modules/next/dist/compiled/webpack/bundle4.js'
- '!node_modules/next/dist/compiled/webpack/bundle5.js'
- '!node_modules/next/dist/compiled/terser/bundle.min.js'
- '!node_modules/sharp/**/*'
node_bundler: nft
_ipx:
node_bundler: nft
plugins:
- inputs: {}
origin: config
package: '@netlify/plugin-nextjs'
redirects:
- from: /_next/image*
query:
q: ':quality'
url: ':url'
w: ':width'
status: 301
to: /_ipx/w_:width,q_:quality/:url
- from: /_ipx/*
status: 200
to: /.netlify/builders/_ipx
- force: true
from: /cache/*
status: 404
to: /404.html
- force: true
from: /server/*
status: 404
to: /404.html
- force: true
from: /serverless/*
status: 404
to: /404.html
- force: true
from: /traces
status: 404
to: /404.html
- force: true
from: /routes-manifest.json
status: 404
to: /404.html
- force: true
from: /build-manifest.json
status: 404
to: /404.html
- force: true
from: /prerender-manifest.json
status: 404
to: /404.html
- force: true
from: /react-loadable-manifest.json
status: 404
to: /404.html
- force: true
from: /BUILD_ID
status: 404
to: /404.html
- from: /_next/static/*
status: 200
to: /static/:splat
- conditions:
Cookie:
- __prerender_bypass
- __next_preview_data
from: /*
status: 200
to: /.netlify/functions/___netlify-handler
- from: /*
status: 200
to: /.netlify/functions/___netlify-handler
redirectsOrigin: inline
Process finished with exit code 2
|
Beta Was this translation helpful? Give feedback.
-
Hello ! PS: When we remove this, the app works, so good work ;) |
Beta Was this translation helpful? Give feedback.
-
Hi, pinging this once again - I just need to know if next/image will be compatible with the v4 plugin. |
Beta Was this translation helpful? Give feedback.
-
I've been having another issue with query parameters not displaying in It seems like something about how the script handles dynamic routes- query parameters show up fine if you have no pages in the catch all route/ This site has a demo: https://hungry-kalam-fec644.netlify.app/api/test?query=abced And this repo should have a basic case: https://github.com/ChrisW-B/next-demo Let me know if there's anything else I can do to help track it down! |
Beta Was this translation helpful? Give feedback.
-
I just tried the latest versions 4.0.0-beta.8 and 4.0.0-beta.9 and get 404 and 500 errors:
The pages are using |
Beta Was this translation helpful? Give feedback.
-
Hey there — good work so far on this plugin! Exciting stuff. I'm not sure this is specific to v4 of the plugin, but it doesn't really work when using it inside of an Nx monorepo where there are multiple apps/Netlify sites/ |
Beta Was this translation helpful? Give feedback.
-
Problems with beta 8 and 9Beta 8 - Build errorThis only happens when running beta 8
Beta 9 - Causes infinite loop on page hooking into routerWhen using beta 9, a page using React.useEffect will loop infinitely. import { useRouter } from "next/router";
const router = useRouter();
useEffect(() => {
// This logic will run be called infinitely
}, [router.query.someProp]); |
Beta Was this translation helpful? Give feedback.
-
Syntax error: Nullish coalescing operatorI get an error in the ___netlify-odb-handler function when deployed to Netlify. ERROR /var/task/.next/server/pages/_app.js:144 Is the Nullish coalescing operator not supported? I am currenty on: |
Beta Was this translation helpful? Give feedback.
-
Next redirect behind blocking Optional catch all route not working.I am trying to get the redirects in next.config.js to work. I have tested to create a simple redirect on root level.
This works as expected. But if I create a redirect behind a Optional catch all route that has fallback: "blocking", the redirect fails. This is my folder setup: /pages pages/collection/[[...slug]].js When I try to redirect a page inside /pages/collection/blog/ or /pages/collection/news/, the redirect fails and gets redirected to /pages/collection/[[..slug]].js. That again fails because of incorrect slug. So if I redirect from /pages/collection/news/new-slug to /pages/collection/news/old-slug it fails. At the moment I have other non-conflicting redirects in _redirects and in netlify.toml. Is this a problem or can I use _redirects, netlify.toml and next.config.js redirects at the same time? This is how my route looks in next.config.js
I hope this is understandable, if not I can try to create a minimal reproduction repo. When running netlify dev locally, the redirects works as expected. I am using this to create my redirects: I am currenty on: |
Beta Was this translation helpful? Give feedback.
-
.setHeader in getServerSideProps is being ignored once deployed to Netlify.I set header via getServerSideProps, while everything works fine while testing it locally, the header is being re-set to This is how this function looks like:
Currently using:
|
Beta Was this translation helpful? Give feedback.
-
I'm getting "Internal Server Error" for every page despite a successful build. Can't publish my repo here, but my netlify username is also lucaslcode. |
Beta Was this translation helpful? Give feedback.
-
I'm getting an issue where one of the static page (i.e. More details:
Update: |
Beta Was this translation helpful? Give feedback.
-
when using
although there is no redirect rule specified in |
Beta Was this translation helpful? Give feedback.
-
Using This only happens in production when deployed on Netlify. Happy to provide more context, just not sure what is helpful. |
Beta Was this translation helpful? Give feedback.
-
Plugin rewrite
today (2021-10-15) we released the beta of our full plugin rewrite!
this rewrite is a major improvement from its predecessor and resolves many of the old plugin's pain points. the old plugin is <= v3, and the new rewritten plugin is v4. the v4 beta will likely last about a month or so.
while v4 is in beta, next.js sites on netlify that have our plugin autoinstalled will continue to run v3.
Testing
to test the beta, you'll need to follow these steps, currently laid out in our README:
Discussion
please use this discussion to share any thoughts, feedback, or questions about the beta. if you have a specific reproducible bug report, please open an issue. we're excited to hear how it works for everyone!! 🙏
Official release
when we officially release v4, auto-installed sites with v3's netlify configurations will no longer work, due to our new publish directory requirement. this will inevitably cause some breaking builds/sites, and we're currently exploring ways to best mitigate this transition. we'll be providing a migration guide and clearer documentation ahead of the release. any feedback on migration is appreciated as well!
Beta Was this translation helpful? Give feedback.
All reactions