Astro Info
Astro v4.5.18
Node v20.11.1
System macOS (arm64)
Package Manager npm
Output server
Adapter @astrojs/node
Integrations @astrojs/tailwind
@astrojs/vue
astro-auth
@astrojs/react
@sentry/astro
If this issue only occurs in one browser, which browser is a problem?
No response
Describe the Bug
I get the following error when building on CI server:
12:39:27 [ERROR] [vite] x Build failed in 11.04s
TypeError: possibleFilePath?.replace is not a function
at collectInfoFromStacktrace (file:///app/node_modules/astro/dist/core/errors/dev/utils.js:109:38)
at file:///app/node_modules/astro/dist/core/errors/dev/utils.js:17:25
at Array.forEach (<anonymous>)
at collectErrorMetadata (file:///app/node_modules/astro/dist/core/errors/dev/utils.js:15:7)
at throwAndExit (file:///app/node_modules/astro/dist/cli/throw-and-exit.js:16:29)
at cli (file:///app/node_modules/astro/dist/cli/index.js:172:11)
Unfortunately, I can't reproduce it locally or on stackblitz. It actually masks another error I'm debugging. However, looking at the code, I see a potential mistake that the second replace is not called defensively:
const source = possibleFilePath?.replace(/^[^(]+\(([^)]+).*$/, '$1').replace(/^\s+at\s+/, '');
In any case, collectInfoFromStacktrace function is not robust against potentially missing data.
What's the expected result?
Astro's error handling should be robust. Showing raw error is always better than masking the error with own failure.
Link to Minimal Reproducible Example
N/A
Participation
Astro Info
If this issue only occurs in one browser, which browser is a problem?
No response
Describe the Bug
I get the following error when building on CI server:
Unfortunately, I can't reproduce it locally or on stackblitz. It actually masks another error I'm debugging. However, looking at the code, I see a potential mistake that the second
replaceis not called defensively:In any case,
collectInfoFromStacktracefunction is not robust against potentially missing data.What's the expected result?
Astro's error handling should be robust. Showing raw error is always better than masking the error with own failure.
Link to Minimal Reproducible Example
N/A
Participation