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

server:defer Causes Astro.getActionResult to Fail #12371

Open
1 task
xpawk opened this issue Nov 4, 2024 · 5 comments
Open
1 task

server:defer Causes Astro.getActionResult to Fail #12371

xpawk opened this issue Nov 4, 2024 · 5 comments
Assignees
Labels
feat: server islands Related to Server Islands (scope)

Comments

@xpawk
Copy link

xpawk commented Nov 4, 2024

Astro Info

Astro                    v4.16.9
Node                     v20.10.0
System                   macOS (arm64)
Package Manager          npm
Output                   server
Adapter                  @astrojs/node

If this issue only occurs in one browser, which browser is a problem?

No response

Describe the Bug

I’m encountering an issue with Astro’s server:defer. Specifically, when applying server:defer to the component below, the function Astro.getActionResult(actions.testAction) doesn't work as expected and fails to return an error if one occurs:


Within the component, the following function is used:
const result = Astro.getActionResult(actions.testAction);

Issue: The function does not execute as intended, and any errors are not returned or displayed.

What's the expected result?

I expect Astro.getActionResult to properly execute and, in cases of failure, to return an error message that can be handled.

Link to Minimal Reproducible Example

https://stackblitz.com/edit/withastro-astro-b6b86s?file=src%2Fpages%2Findex.astro

Participation

  • I am willing to submit a pull request for this issue.
@github-actions github-actions bot added the needs triage Issue needs to be triaged label Nov 4, 2024
@apatel369
Copy link
Contributor

apatel369 commented Nov 5, 2024

I am seeing this log in dev. [astro:actions] POST requests should not be sent to prerendered pages. If you're using Actions, disable prerendering with `export const prerender = false

I removed server:defer from your reproduction and I still see the same log so it does not seem to be a server islands related issue.

@xpawk
Copy link
Author

xpawk commented Nov 5, 2024

HI @apatel369 could you please run https://stackblitz.com/edit/withastro-astro-b6b86s?file=src%2Fpages%2Findex.astro localy cause on stackblitz there is an issue with getting Astro.clientAddress and its unpossible to reproduce this error

@apatel369
Copy link
Contributor

apatel369 commented Nov 5, 2024 via email

@xpawk
Copy link
Author

xpawk commented Nov 5, 2024

i ve changed stackblitz a bit now prerender is set to false and bug i described is occurring

@matthewp
Copy link
Contributor

matthewp commented Nov 6, 2024

Are the delays in the stackblitz required for the bug to occur?

@matthewp matthewp self-assigned this Nov 6, 2024
@matthewp matthewp added feat: server islands Related to Server Islands (scope) and removed needs triage Issue needs to be triaged labels Nov 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feat: server islands Related to Server Islands (scope)
Projects
None yet
Development

No branches or pull requests

3 participants