question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

$page.query returns empty on prerendered pages

See original GitHub issue

Describe the bug Using $page.query sometimes returns as empty for pages with a query string.

To Reproduce In my experience, any basic page using page from the store.

Expected behavior It should always have the current page query string

Severity It made this feature currently unusable for me. In my case, I can check with browser and use window.location.search instead. But I’m not sure how severe this might be for those relying on it in the backend.

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:11 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
milky2028commented, May 3, 2021

This is the same thing I’m experiencing, but I’m using adapter-static.

On May 3, 2021, at 12:18 PM, uzuworks @.***> wrote:

I don’t know if it is the same, but I am experiencing a similar thing. In my case, it doesn’t happen with “dev” or “preview" (a query exists), but when I build and run it with adapter-node.

I tried to create a simple reproduction environment. https://github.com/uzuworks/query_example

As access the index with search parameters “npm run dev”: no problem “npm run build && npm run preview”: no problem "npm run build && node ./build/“: only when I run this, the query doesn’t exist

— You are receiving this because you commented. Reply to this email directly, view it on GitHub, or unsubscribe.

0reactions
benmccanncommented, May 26, 2021

This happens when the page is prerendered. Closing as duplicate of https://github.com/sveltejs/kit/issues/669

Read more comments on GitHub >

github_iconTop Results From Across the Web

General tips and best practices - Troubleshooting - Prerender.io
Prerender gives back raw or empty content. If the prerender returns an X-Prerender-Raw-Data header, the crawler cannot render the page and ...
Read more >
Next.js router.query getting undefined on refreshing page, but ...
During prerendering, the router's query object will be empty since we do not have query information to provide during this phase.
Read more >
Using Prerender.io and avoiding prerender of nonexistent pages
The issue is this is causing a bunch of blank pages to be pre-rendered as it seems random bots keeps trying to access...
Read more >
Data Fetching: getStaticProps - Next.js
Fetch data and generate static pages with `getStaticProps`. ... Next.js will pre-render this page at build time using the props returned by getStaticProps...
Read more >
Prerender | RedwoodJS Docs
This error happens during builds when you have a Cell on a page you're prerendering that makes a query marked with @requireAuth in...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found