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

Error Fetching PageData during Client-Side Route Transition #29

Open
ismail424 opened this issue Sep 16, 2023 · 4 comments
Open

Error Fetching PageData during Client-Side Route Transition #29

ismail424 opened this issue Sep 16, 2023 · 4 comments

Comments

@ismail424
Copy link

When using the Bun adapter with SvelteKit, I encounter an internal 500 error during client-side navigation (when pressing on a "a tag with href").

The error seems related to fetching PageData for that route.

It works fine if I refresh the page but when I navigate to it with client-side-navigation it gives me the error.

Steps to Reproduce:

1. Set up a SvelteKit project with the Bun adapter.
2. Create a route that returns PageServerLoad via the load function from +page.server.ts/js
3. Create a +page.ts/js and fetch that data
4. Navigate to the route using client-side navigation, can be an "a tag" with href to that route.
Observe an internal 500 error when SvelteKit attempts to fetch the data for the page.

Expected Behavior:

 Client-side navigation should work without errors, and PageData should be fetched successfully.
 Actual Behavior:
 Internal 500 error occurs, with the response: {"message":"Internal Error"}. 
 Then it console logs the following: {"originalLine":273,"originalColumn":18}.

Additional Information:
Request URL causing the issue: http://localhost:3000/settings/__data.json?x-sveltekit-invalidated=0011
SvelteKit version: latest
Bun adapter version: 0.5.0

Error Logs:

 Console Output: {"originalLine":273,"originalColumn":18}
 Server Response: {"message":"Internal Error"}

Screenshots (if applicable):
Screenshot_20230916_223517
Screenshot_20230916_223744

@maietta
Copy link

maietta commented Sep 17, 2023

What was the solution?

@ismail424
Copy link
Author

ismail424 commented Sep 17, 2023

I actually don't know, When I created a new project using bun create svelte@latest my-app and ran a demo app.
It magically fixed the problem but I think some datatypes are not allowed to be returned from PageData or something like that. I am currently trying to debug it to se what is causing the problem.

This down bellow is a example code from the demo app that works. 🤔
image

@ismail424 ismail424 reopened this Sep 17, 2023
@ismail424
Copy link
Author

It was a problem with a datatype that was returnered, It was a 'Invalid date' (Error) that was accidently returned.

@notramo
Copy link

notramo commented Oct 2, 2024

@ismail424, could you test this again? It seems it is a Bun Node compatibility error, which is likely resolved since.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants