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

Actions not working when using getStaticPaths #12848

Open
1 task
MarcoAntonioGonCas opened this issue Dec 29, 2024 · 0 comments
Open
1 task

Actions not working when using getStaticPaths #12848

MarcoAntonioGonCas opened this issue Dec 29, 2024 · 0 comments
Labels
needs triage Issue needs to be triaged

Comments

@MarcoAntonioGonCas
Copy link

MarcoAntonioGonCas commented Dec 29, 2024

Astro Info

Astro                    v5.1.1
Node                     v22.12.0
System                   Windows (x64)
Package Manager          npm
Output                   static
Adapter                  @astrojs/node
Integrations             @astrojs/tailwind

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

No response

Describe the Bug

Actions not working when using getStaticPaths

---
import { actions } from "astro:actions";



export const getStaticPaths = ( async() => {

  // const {data,error} = await actions.exampleAction("");
  const {data,error} = await Astro.callAction(actions.exampleAction,"");

  return []

}) ;
---

Error using const {data,error} = await actions.exampleAction("");

Action called from a server page or endpoint without using Astro.callAction(). This wrapper must be used to call actions from server code.
See Docs Reference
See the Astro.callAction() reference for usage examples: https://docs.astro.build/en/reference/api-reference/#callaction

Error using const {data,error} = await Astro.callAction(actions.exampleAction,"");

Action unexpected called from the server.
Action called from a server page or endpoint without using Astro.callAction(). This wrapper must be used to call actions from server code.
See

What's the expected result?

The result of the actions.

Link to Minimal Reproducible Example

https://stackblitz.com/edit/github-cf4irmmq?file=README.md

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 Dec 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs triage Issue needs to be triaged
Projects
None yet
Development

No branches or pull requests

1 participant