-
-
Notifications
You must be signed in to change notification settings - Fork 2.9k
Open
Labels
- P2: nice to haveNot breaking anything but nice to have (priority)Not breaking anything but nice to have (priority)feat: routingRelated to Astro routing (scope)Related to Astro routing (scope)
Description
Astro Info
Astro v4.15.8
Node v18.20.3
System Linux (x64)
Package Manager unknown
Output static
Adapter none
Integrations none
If this issue only occurs in one browser, which browser is a problem?
No response
Describe the Bug
If I have a route like this:
/categories/[category]/
+-- index.astro
+-- [page].astro
In which each endpoint exports getStaticPaths, one for matching the base route with the category param, another for the category param with pagination.
If I include the following in astro.config.mjs:
// ...
redirects: {
'/categories/[category]': '/category/[category]/1',
},
// ...Running astro build yields this error:
[ERROR] [build] Failed to call getStaticPaths for /categories/[category]
[GetStaticPathsRequired] `getStaticPaths()` function is required for dynamic routes. Make sure that you `export` a `getStaticPaths` function from your dynamic route.
What's the expected result?
I would expect this setup to build without errors. It's my understanding that configured redirects are supported in static render mode, and even if this isn't the case, the error doesn't make sense and took far too long to for me to track down the source of the problem.
Link to Minimal Reproducible Example
https://stackblitz.com/edit/withastro-astro-vyvufy?file=src%2Fpages%2Findex.astro
Participation
- I am willing to submit a pull request for this issue.
brpaz, lanelps, kirontoo, kitschpatrol, OSSRoger and 4 more
Metadata
Metadata
Assignees
Labels
- P2: nice to haveNot breaking anything but nice to have (priority)Not breaking anything but nice to have (priority)feat: routingRelated to Astro routing (scope)Related to Astro routing (scope)