solid-start icon indicating copy to clipboard operation
solid-start copied to clipboard

[Bug?]: internal $fetch (Nitro) looping endlessly in build pre-rendering since 1.0.7

Open Jylth opened this issue 4 months ago • 2 comments

Duplicates

  • [X] I have searched the existing issues

Latest version

  • [X] I have tested the latest version

Current behavior 😯

Since 1.0.7, in a setup where we have internal API routes, and we're trying to fetch them in the nitro build through the $fetch helper, the page is rendering endlessly in a stuck loop.

https://nitro.unjs.io/guide/fetch#in-server-fetch.

Downgrading @solidjs/start to 1.0.6 fixes the issue.

Expected behavior 🤔

Same behaviour as 1.0.6, which doesn't break internal api calls through the $fetch event helper.

Steps to reproduce 🕹

Steps:

  1. Go to https://stackblitz.com/~/github.com/Jylth/solid_issue_prerender_fetch_internal_api?file=src/routes/index.tsx
  2. Run a build with pnpm build
  3. Observe that the page prerendering of the index is looping endlessly

To fix the issue, simply downgrade the @solidjs/start package to 1.0.6.

Context 🔦

This breaks an app which was working well since a couple of months on v1.0.6. Upgrading to a more recent version of the package breaks it completely.

The behaviour on a more complex app is a bit different. Instead of looping endlessly, the nitro server simply stops after trying prerendering the route and the build fails. Logging the requests in a middleware shows that the internal API calls are received, but the path of the request is missing, they all go to the root /.

Might be the same issue as #1640

Jylth avatar Oct 09 '24 19:10 Jylth