Error on build command with sitemap to true
layout-ch opened this issue · comments
Hey, I get this error :
[AstroUserError] This situation should never occur (a corresponding routeData should always be found)
Whenever I'm trying to build the website. It only occurs when I have sitemap to true so I guess the problem comes from there.
I did a small demo to reproduce the error at : https://github.com/layout-ch/error-demo/
Steps to reproduce :
- yarn install
- npm run build
Thanks in advance for your help ! 🙏🏼
Thanks for the minimal repro! I'll have a look tomorrow
I think I found what the problem was, when the slug is uppercase, it crashes. Turned all of my routes to lowercase and now it works !
I'm going to check if I have any logic involving downcasing, thanks for reporting
EDIT: there are not any
Alright so on RouteData
I'm using route
but looks like I should be using pathname
which preserves casing
Apparently it's better to use generate
and pass params
if it's dynamic. We can check if it's dynamic if at least one segment has dynamic: true