-
Notifications
You must be signed in to change notification settings - Fork 86
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
[Bug]: Plugin "@netlify/plugin-nextjs" internal error: ENOENT: no such file or directory with runtime 5.0.0-beta.7 #2420
Comments
I believe the file does exist at I don't have a solution yet, but maybe someone working on the plugin knows where this bug is. Will dig a bit |
Based on testing in the codebase that @caomicc originally posted it appears that there's a bug in the 5.x-beta.7 and 8 version of the @netlify/plugin-nextjs that it assumes the wrong path. From a team member
|
We are now experiencing the same issue with it not being able to find the |
Hey @jesseday and @SilverFox70. We just released an early access version that should fix many issues. Thanks! |
@MarcL Hi, I too am still having this issue. Once trying this update to
Reverting to |
@caomicc @jesseday @SilverFox70 - We've released |
I ran into something similar, and I think I have a workaround. TL;DR: instead of reading from const path = require('path');
module.exports = {
async onPostBuild({ constants, inputs }) {
const { PUBLISH_DIR } = constants; // where PUBLISH_DIR === '.next'
const mediaDir = 'static/media';
< const cwd = path.join(PUBLISH_DIR, mediaDir);
> const cwd = path.join('.netlify', PUBLISH_DIR, mediaDir);
// ...
}
}; After upgrading to Some digging, I found that
FWIW, when I inspect the root |
Root issue seems to stem from this behavior in the var onPostBuild = async (options) => {
await tracer.withActiveSpan("onPostBuild", async () => {
await publishStaticDir(new PluginContext(options));
});
};
...
var onEnd = async (options) => {
await tracer.withActiveSpan("onEnd", async () => {
await unpublishStaticDir(new PluginContext(options));
});
};
...
var publishStaticDir = async (ctx) => {
try {
await rm(ctx.tempPublishDir, { recursive: true, force: true });
await mkdir(basename(ctx.tempPublishDir), { recursive: true });
await rename(ctx.publishDir, ctx.tempPublishDir);
await rename(ctx.staticDir, ctx.publishDir);
} catch (error) {
ctx.failBuild("Failed publishing static content", error instanceof Error ? { error } : {});
}
};
var unpublishStaticDir = async (ctx) => {
try {
if (existsSync(ctx.tempPublishDir)) {
await rename(ctx.publishDir, ctx.staticDir);
await rename(ctx.tempPublishDir, ctx.publishDir);
}
} catch {
}
}; So any plugin with an Knowing this, a better workaround (instead of reading -[[plugins]]
- package = "@netlify/plugin-nextjs"
[[plugins]]
package = "@newrelic/netlify-plugin"
[[plugins]]
package = "./plugins/my-custom-plugin"
+[[plugins]]
+ package = "@netlify/plugin-nextjs" |
@dragons-library yes, I'd recommend just ensuring the Netlify plugin runs last, rather than relying on the internals of our build process. Everyone else: in 5.1.2 there are some improvements to finding the build output on sites with custom setups, so if you have issues that relate to that then I'd recommend trying again to see if it now works |
Summary
I'm having an issue with getting our site to run on the beta runtime. We are currently on next
13.4.1
and testing with5.0.0-beta.7
We are using turborepo for this site and have custom build settings in our
netlify.toml
to reflect thatOnce committed, the deploy will build successfully and then fail after the
onBuild
with the following error:For what its worth, I did attempt to submit an issue on the requested links in that error, but was getting a 404.
I am wondering if the missing file is related to the monorepo?
Thanks!
A link to a reproduction repository
https://app.netlify.com/sites/workhuman-next/deploys/65c25a12e9e90f000874c61a
Expected Result
No internal errors + build to deploy successfully
Actual Result
Plugin "@netlify/plugin-nextjs" internal error
Steps to reproduce
Next Runtime version
5.0.0-beta.7
Is your issue related to the
app
directory?app
directoryMore information about your build
netlify.toml
)What OS are you using?
Mac OS
Your netlify.toml file
`netlify.toml`
Your public/_redirects file
`_redirects`
Your
next.config.js
file`next.config.js`
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: