You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hey Vercel team 👋
Wondering if someone could spare a second to help me on this:
I've got an Astro project, for which I am using the Vercel CLI.
There's no trace of React or Next.js in my repo project.
Yet when I have a route or component named /src/pages/api-troubleshooting.astro then Vercel CLI starts throwing tons of warnings, saying:
WARN!
When using Next.js, it is recommended to place JavaScript Functions inside of the
pages/api (provided by Next.js) directory instead of api (provided by Vercel). Other
languages (Python, Go, etc) should still go in the api directory.
Learn More: https://nextjs.org/docs/api-routes/introduction
'When using Next.js, it is recommended to place JavaScript Functions inside of the `pages/api` (provided by Next.js) directory instead of `api` (provided by Vercel). Other languages (Python, Go, etc) should still go in the `api` directory.',
If you need a formal bug report before this can be reviewed or looked into, I've written one up below:
Bug Report: Vercel CLI shows Next.js error if page begins with `api-`, even if Next.js is not present in project
Summary
When using the Vercel CLI with an Astro app (without React or Next.js), any pages which start with api, such as src/pages/api-setup-guide.astro will throw the following warning
WARN! When using Next.js, it is recommended to place JavaScript Functions inside of the pages/api (provided by Next.js) directory instead of api (provided by Vercel). Other languages (Python, Go, etc) should still go in the api directory.
Learn More: https://nextjs.org/docs/api-routes/introduction
User sees a barage of warnings from the Vercel CLI, informing them not to put Next.js API routes in Astro pages. This occours on a totally vanillar Astro app, with no traces of either React nor Next.js, just because they have an Astro route beginning with pages/api-XXX
Hey Vercel team 👋
Wondering if someone could spare a second to help me on this:
I've got an Astro project, for which I am using the Vercel CLI.
There's no trace of React or Next.js in my repo project.
Yet when I have a route or component named
/src/pages/api-troubleshooting.astro
then Vercel CLI starts throwing tons of warnings, saying:If it helps, here's a screenshot of the issue.
Fix
I've submitted a fix for this in #11611
And would really appreciate a quick review, if any of you had a moment
Cause
Expand Root Cause
This is appears to be caused by
fileName.startsWith('pages/api')
invercel/packages/fs-detectors/src/detect-builders.ts
Lines 215 to 220 in 80e0bab
Which in turn throws the warning which is being repeatidly displayed in loop
vercel/packages/fs-detectors/src/detect-builders.ts
Lines 335 to 347 in 80e0bab
This feature appears to have been added in #3784 (specifically, this commit specifically).
Bug Report
If you need a formal bug report before this can be reviewed or looked into, I've written one up below:
Summary
When using the Vercel CLI with an Astro app (without React or Next.js), any pages which start with
api
, such assrc/pages/api-setup-guide.astro
will throw the following warningSteps to Reproduce
npm create astro@latest
npx astro add vercel
touch src/pages/api-docs.astro
vercel dev
Minimal reproducible example: https://stackblitz.com/edit/github-yogmzg-d6z7xm
Expected Behavior
No warnings. Because everything is 200 okay :)
Actual Behavior
User sees a barage of warnings from the Vercel CLI, informing them not to put Next.js API routes in Astro pages. This occours on a totally vanillar Astro app, with no traces of either React nor Next.js, just because they have an Astro route beginning with
pages/api-XXX
Environment Info
Vercel CLI: 34.2.0
Node: v20.13.1
Astro: 4.8.6
@astrojs/vercel: 7.5.4
OS: Arch Linux, 2024.05.01
Areas Affected
Vercel CLI
Thanks for taking the time to check this out, really appreciate it ❤️
If you need any more details, please let me know, and I'll be happy to help :)
The text was updated successfully, but these errors were encountered: