#Api Handler Router Error

25 messages · Page 1 of 1 (latest)

lethal current
#

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
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?

proud nexusBOT
#

🔎 This post has been indexed in our web forum and will be seen by search engines so other users can find it outside Discord

🕵️ Your user profile is private by default and won't be visible to users outside Discord, if you want to be visible in the web forum you can add the "Public Profile" role in id:customize

✅ You can mark a message as the answer for your post with Right click -> Apps -> Mark Solution
(if you don't see the option, try refreshing Discord with Ctrl + R)

pine lance
#

show your route.tsx file (but i think its because you are exporting something that isnt GET/POST/PATCH/PUT/DELETE/HEAD/OPTIONS)

lethal current
#

This is what I am exporting

pine lance
#

hmm and what is the lib you are using here? (ie type of handle(app))

lethal current
#
import { Button, Frog } from "frog";
import { handle } from "frog/next";
#

From the frog library

pine lance
#

this is odd as you only have export of GET+POST and the lib should have proper types

lethal current
#

it does

pine lance
#

did vercel like not download your dep

lethal current
#

no error is thrown whatsoever

#

it did.

#

check the image for the error in vercel build

pine lance
#

yeah i see the error

lethal current
#

okay

pine lance
lethal current
#

This is everything it logged

pine lance
#

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 funnyness

lethal current
#

okay. let me try that

lethal current
#

No, it's still the same

lethal current
#

fixed it

#
//Wrong
export const app = new Frog({
  basePath: "/api",
});
//Right
const app = new Frog({
  basePath: "/api",
});
#

i was exporting the frog instance declared here

proud nexusBOT
#
✅ Success!

This question has been marked as answered! If you have any other questions, feel free to create another post

Jump to answer

[Click here](#1256113739875356773 message)