Closed Grahf0085 closed 1 month ago
Possible associated with #11423
@ynhhoJ Hm, that issue is specific to Stackblitz and some edge environments. @Grahf0085 are you using Vercel edge middleware in your project?
Update: I've built an example project using Vercel serverless with the SolidJS integration installed. I've confirmed that the following work as expected:
getActionProps()
I managed to get a build error by enabling edgeMiddleware
. This is the same error that we receive from Netlify, and we have a fix planned. I unfortunately could not replicate the exact issue log you're seeing though.
I believe I've seen your issue log when an action returns undefined
or a falsy value like 0
. This was fixed and will be released in the next patch!
Would mind installing astro@latest
and trying again? Note: there was a change to make .safe()
the default behavior in actions as well. Please check the changelog for necessary refactors to use this patch.
@bholmesdev thanks for the follow up.
As far as I know I am not using vercel edge middleware. I updated to Astro 4.13.0. Changed my logout action from:
const { data, error } = await actions.logoutUser.safe({})
(this works)
To:
const { data, error } = await actions.logoutUser()
I got the same error message as when I was using const { data, error } = await actions.logoutUser.safe()
I'll keep an eye out for the next patch!
Got it. Thanks for verifying @Grahf0085! We uncovered an issue with using response.clone()
in https://github.com/withastro/astro/issues/11423 that I'm PR-ing a fix for shortly. We'll see if that affects anything in your environment. To be sure, you are not using bun, correct?
Astro Info
Describe the Bug
I have this logout action:
const { data, error } = await actions.logoutUser.safe()
This woks fine on local host when running dev server and when using the node adapter and running the app using entry.mjs.
But when deployed to vercel I get this error when the logout function runs:
It's fixed by adding an empty object as a argument to the .safe() function:
const { data, error } = await actions.logoutUser.safe({})
Not sure if it's document somewhere that an empty object needs to be passed to .safe() when it has no other arguments or if this is a bug.
To reproduce you will need to go to my site (https://sharper-than-time-c1ti0fvty-grahf0085s-projects.vercel.app/), make an account, and click the logout button. I can only produce this on vercel so.....
This is my logout action if it matters:
What's the expected result?
The logout function runs without producing an error
Link to Minimal Reproducible Example
https://sharper-than-time-c1ti0fvty-grahf0085s-projects.vercel.app/
Participation