Skip to content

v3.4.1 breaks netlify nextjs build #387

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

Closed
fletcherist opened this issue Jun 4, 2021 · 12 comments
Closed

v3.4.1 breaks netlify nextjs build #387

fletcherist opened this issue Jun 4, 2021 · 12 comments
Labels
priority: high type: bug code to address defects in shipped code

Comments

@fletcherist
Copy link

Describe the bug
v3.4.1 breaks my site deployment, while v3.3.1 works

To Reproduce
Deploying the same commit:

v3.3.1 behavior (from netlify deploy logs)

 4. onBuild command from @netlify/plugin-nextjs
...
Building 18 pages
💼 Copying WP4 dynamic import chunks to netlify/functions/next_app/nextPage
etc...

v3.4.1

 4. onBuild command from @netlify/plugin-nextjs
...
Building 0 pages

Versions

  • Next.js: 10.0.9
  • plugin (if installed at fixed version): 3.4.1

If you're using file-based installation

  • netlify.toml:
[build]
  command = "yarn graphql && npm run build"
  publish = "out"

[[plugins]]
  package = "@netlify/plugin-nextjs"
@zommerberg
Copy link

Same here

@lindsaylevine
Copy link

on it. about to revert to 3.3.1. that said, i'm unable to reproduce this for myself. can anyone provide a repo that reproduces the issue? 🙏

@lindsaylevine lindsaylevine added priority: high type: bug code to address defects in shipped code labels Jun 4, 2021
@zommerberg
Copy link

Can't provide you a repo but a static app with getStaticPaths that generates pages should work. aka a blog post

@fletcherist
Copy link
Author

on it. about to revert to 3.3.1. that said, i'm unable to reproduce this for myself. can anyone provide a repo that reproduces the issue? 🙏

ok i'll try to create reproducible env

@antho1404
Copy link

antho1404 commented Jun 4, 2021

Here is an issue with the problem and a workaround + reproducible repository

@lindsaylevine
Copy link

hello! thank you all. i believe we've diagnosed the issue, and that it's not actually related to the basePath work as @antho1404 suspected yesterday in 3.4.0. at the moment we believe it's somewhere in here that is causing builds to fail without a config file: #343 (but an empty config even resolves the issue). we will keep you updated, thanks a bunch again!!! 🙏

@lindsaylevine
Copy link

@antho1404 can you try 3.4.2 in prod/netlify for me please? it resolved my issue but wanna be sure youre seeing it too before i default the plugin version to 3.4.2 after 2 other breaking releases. just install @netlify/[email protected]. lmk!

@lindsaylevine
Copy link

or anyone else!

@antho1404
Copy link

Here is the result of my tests:

It did not work with this fix.

// next.config.js
module.exports = {
  basePath: '',
}

I had to remove my next.config.js.

If I keep it, my logs in local with netlify build show this (similar issue on a deploy preview):

────────────────────────────────────────────────────────────────
  4. onBuild command from @netlify/plugin-nextjs
────────────────────────────────────────────────────────────────

Your next.config.js must set the "target" property to one of: serverless, experimental-serverless-trace. Update the
      target property to allow this plugin to run.

(@netlify/plugin-nextjs onBuild completed in 6ms)

────────────────────────────────────────────────────────────────
  5. onBuild command from netlify-plugin-inline-functions-env
────────────────────────────────────────────────────────────────


────────────────────────────────────────────────────────────────
  Plugin "netlify-plugin-inline-functions-env" failed
────────────────────────────────────────────────────────────────

  Error message
  Error: No function directory was specified

  Plugin details
  Package:        netlify-plugin-inline-functions-env
  Version:        1.0.8
  npm link:       https://www.npmjs.com/package/netlify-plugin-inline-functions-env
  Report issues:  https://github.com/bencao/netlify-plugin-inline-functions-env/issues

  Error location
  In "onBuild" event in "netlify-plugin-inline-functions-env" from netlify.toml
      at listAll (/node_modules/netlify-cli/node_modules/@netlify/functions-utils/src/main.js:62:12)
      at processFiles (/.netlify/plugins/node_modules/netlify-plugin-inline-functions-env/index.js:33:50)

  Resolved config
  build:
    command: npm run build
    commandOrigin: ui
    publish: /Users/antho/prog/quiver/emotional-nft-dapp/out
  plugins:
    - inputs: {}
      origin: ui
      package: '@netlify/plugin-nextjs'
    - inputs: {}
      origin: config
      package: netlify-plugin-contextual-env
    - inputs: {}
      origin: config
      package: netlify-plugin-inline-functions-env

For information, I tested as well on 3.3.1, and the issue is similar, so at least this is not a breaking change for this plugin and might be another unrelated issue.

Everything works fine without the next.config.js in local and deploy preview for my projects but it will break projects that used the fix of basePath: '' to have a workaround for 3.4.x.

@lindsaylevine
Copy link

this is an intentional error. this is the previous behavior we used (since the plugin was born) for existing next.config.js users. all any user has to do in this case is add the target property to their existing next.config.js to proceed. if no next config exists, then the plugin makes it for you. we do not try to change your existing next.config.js for you. but, in 3.4.0, we tried to force the target, and we believe this is/was the source of unbuilt projects in netlify production in 3.4.0 and 3.4.1.

@fletcherist
Copy link
Author

3.4.2 works for me. thanks!

@antho1404
Copy link

Works fine for me as well. Thanks for the time to fix this :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
priority: high type: bug code to address defects in shipped code
Projects
None yet
Development

No branches or pull requests

4 participants