Api Handler Router Error
Answered
Irish Terrier posted this in #help-forum
Irish TerrierOP
I am building a farcaster frame using frog library, so I am using a dynamic path in the api route as documented in frog.fm.
On running
in local development and in vercel build, I get this error:
What could be the issue?
On running
next build in local development and in vercel build, I get this error:
src/app/api/[[...routes]]/route.tsx
Type error: Route "src/app/api/[[...routes]]/route.tsx" does not match the required types of a Next.js Route.
"app" is not a valid Route export field.What could be the issue?
Answered by Irish Terrier
//Wrong
export const app = new Frog({
basePath: "/api",
});//Right
const app = new Frog({
basePath: "/api",
});23 Replies
show your route.tsx file (but i think its because you are exporting something that isnt
GET/POST/PATCH/PUT/DELETE/HEAD/OPTIONS)Irish TerrierOP
This is what I am exporting
hmm and what is the lib you are using here? (ie type of
handle(app))Irish TerrierOP
import { Button, Frog } from "frog";
import { handle } from "frog/next";From the frog library
This is a link:
https://frog.fm/platforms/next
https://frog.fm/platforms/next
this is odd as you only have export of
GET+POST and the lib should have proper typesIrish TerrierOP
it does
did vercel like not download your dep
Irish TerrierOP
no error is thrown whatsoever
it did.
check the image for the error in vercel build
yeah i see the error
Irish TerrierOP
okay
@Irish Terrier okay
can you expand the logs, and see if typescript gives more info
Irish TerrierOP
This is everything it logged
if you disable TS for that page, does everything still work well (
// @ts-nocheck at top of file or maybe // @ts-ignore ontop of export)... like it sounds like chaos and i just want to see if it works and if types broken, or if vercel is doing funnynessIrish TerrierOP
okay. let me try that
Irish TerrierOP
No, it's still the same
Irish TerrierOP
fixed it
Irish TerrierOP
//Wrong
export const app = new Frog({
basePath: "/api",
});//Right
const app = new Frog({
basePath: "/api",
});Answer
Irish TerrierOP
i was exporting the frog instance declared here
I was thinking that lol, but you said only 2 export so I was confused .. glad it's solved!