Skip to content
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

Webpack5 breaks revalidation if getStaticProps loads data from filesystem #23668

Closed
wiesson opened this issue Apr 3, 2021 · 4 comments
Closed
Labels
bug Issue was opened via the bug report template.

Comments

@wiesson
Copy link
Contributor

wiesson commented Apr 3, 2021

What version of Next.js are you using?

next@canary

What version of Node.js are you using?

15.12.0

What browser are you using?

Chrome 89.0.4389.114

What operating system are you using?

  npx envinfo --system --npmPackages next,react,react-dom,typescript --binaries --browsers 

  System:
    OS: macOS 11.2.3
    CPU: (8) arm64 Apple M1
    Memory: 160.52 MB / 16.00 GB
    Shell: 5.8 - /bin/zsh
  Binaries:
    Node: 15.12.0 - /usr/local/bin/node
    Yarn: 1.22.10 - /usr/local/bin/yarn
    npm: 7.8.0 - /usr/local/bin/npm
  Browsers:
    Chrome: 89.0.4389.114
    Firefox: 87.0
    Safari: 14.0.3
  npmPackages:
    next: 10.1.3-canary.2 => 10.1.3-canary.2 
    react: 17.0.2 => 17.0.2 
    react-dom: 17.0.2 => 17.0.2 
    typescript: ^4.2.3 => 4.2.3 

How are you deploying your application?

git / vercel

Describe the Bug

When enabling webpack5, loading data from the filesystem breaks if revalidation is enabled.

Expected Behavior

First, it should not throw an error :). Revalidation of data from the "local" filesystem only does not make any sense, but in some cases, e.g. static data such as translations are loaded from JSON and more dynamic data from external sources.

To Reproduce

Follow https://nextjs.org/docs/basic-features/data-fetching#reading-files-use-processcwd and enable revalidate. The subsequent request will show an error such as:

16:01:15:81
2021-04-03T14:01:15.933Z	9e46c59b-30bf-4c2e-9945-82b2110a5196	ERROR	[Error: ENOENT: no such file or directory, scandir '/var/task/packages/next/data'] {
  errno: -2,
  syscall: 'scandir',
  path: '/var/task/packages/next/data'
}
RequestId: 9e46c59b-30bf-4c2e-9945-82b2110a5196 Error: Runtime exited with error: exit status 1
Runtime.ExitError

Repository that loads data from the filesystem: https://github.com/wiesson/next-test

@wiesson wiesson added the bug Issue was opened via the bug report template. label Apr 3, 2021
@ijjk ijjk closed this as completed Apr 15, 2021
@ijjk
Copy link
Member

ijjk commented Apr 15, 2021

We've landed a patch for this and it should be available soon, will update here when it is!

@ijjk
Copy link
Member

ijjk commented Apr 16, 2021

The above mentioned patch is now available, please re-deploy your application and give it a try!

@wiesson
Copy link
Contributor Author

wiesson commented Apr 19, 2021

No errors - looks like it has been fixed! :)

@balazsorban44
Copy link
Member

This issue has been automatically locked due to no recent activity. If you are running into a similar issue, please create a new issue with the steps to reproduce. Thank you.

@vercel vercel locked as resolved and limited conversation to collaborators Jan 28, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Issue was opened via the bug report template.
Projects
None yet
Development

No branches or pull requests

3 participants