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

useSearchParams fails when dynamic page performs files operations. #43113

Closed
1 task done
kochie opened this issue Nov 19, 2022 · 2 comments
Closed
1 task done

useSearchParams fails when dynamic page performs files operations. #43113

kochie opened this issue Nov 19, 2022 · 2 comments
Labels
bug Issue was opened via the bug report template.

Comments

@kochie
Copy link

kochie commented Nov 19, 2022

Verify canary release

  • I verified that the issue exists in the latest Next.js canary release

Provide environment information

Operating System:
  Platform: darwin
  Arch: x64
  Version: Darwin Kernel Version 21.6.0: Thu Sep 29 20:12:57 PDT 2022; root:xnu-8020.240.7~1/RELEASE_X86_64
Binaries:
  Node: 18.10.0
  npm: 8.19.2
  Yarn: 1.22.19
  pnpm: 7.14.0
Relevant packages:
  next: 13.0.4
  eslint-config-next: 13.0.4
  react: 18.2.0
  react-dom: 18.2.0

What browser are you using? (if relevant)

No response

How are you deploying your application? (if relevant)

Vercel

Describe the Bug

When using the hook useSearchParams in a client component with the experimental: {appDir: true} setting next build does not generate some static assets that are required such as images. This can be seen when running postbuild scripts like next-sitemap or by deploying in vercel, the page will not render and fail with a frontend error.

Error: An error occurred in the Server Components render. The specific message is omitted in production
builds to avoid leaking sensitive details. A digest property is included on this error instance which
may provide additional details about the nature of the error.

But in the functions tab in vercel the following error is generated.

/authors/kochie 
2022-11-18T12:59:21.946Z	1d6e5d87-1cf7-4d8f-bdb5-4d7fbe2bf2c0	ERROR	[Error: Input file is missing: /var/task/public/images/authors/kochie.png]
2022-11-18T12:59:21.946Z	1d6e5d87-1cf7-4d8f-bdb5-4d7fbe2bf2c0	ERROR	[Error: An error occurred in the Server Components render. The specific message is omitted in production builds to avoid leaking sensitive details. A digest property is included on this error instance which may provide additional details about the nature of the error.] {  digest: '1211971591'}

It also should be noted that this only happens when the useSearchParams hook is used in the page or layout tree. I suspect it's an issue with the edge-function runtime however it only happens when a client side component is added.

Expected Behavior

The page should pre-render correctly and perform properly.

Link to reproduction - Issues with a link to complete (but minimal) reproduction code will be addressed faster

https://github.com/kochie/next-bug-reproduction-navigation-search-params

To Reproduce

  1. Go to https://bug-reproduction-kochie1.vercel.app/
  2. /will-fail/page-1 will cause a render failure.

Alternatively clone the repo and deploy yourself, navigating to the will-fail pages will cause server side errors, while will-succeed pages will work.

@kochie kochie added the bug Issue was opened via the bug report template. label Nov 19, 2022
@ijjk
Copy link
Member

ijjk commented Jan 4, 2023

Hi, this should now be resolved in the latest version of Next.js v13.1.1 via #43603 please update and give it a try!

@ijjk ijjk closed this as completed Jan 4, 2023
@github-actions
Copy link
Contributor

github-actions bot commented Feb 3, 2023

This closed issue has been automatically locked because it had no new activity for a month. If you are running into a similar issue, please create a new issue with the steps to reproduce. Thank you.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Feb 3, 2023
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

Successfully merging a pull request may close this issue.

2 participants