Issues calling server/ts function in API route
I'm running into this issue in an API route. It seems that I cannot co-locate ts functions in a
functions
file alongside server functions. This doesn't appear to be an issue when calling server functions not in API routes
eval (/Users/am/Coding/cre-tools/src/web/features/files/functions.ts:63:3)
points to the function
/Users/am/Coding/code/src/web/routes/api/upload.ts?pick=APIRoute:6:31)
points to import { uploadFileFn } from '@/web/features/files/functions'
which is a server function which uses upsertDealFile
.3 Replies
flat-fuchsia•9mo ago
you cannot call server functions in API routes
complex-tealOP•9mo ago
it also seems that if you import the ts function which is colocated with server functions, this error will occur. is that expected? I tried it both ways, calling the ts func or server fn and both had the error
flat-fuchsia•9mo ago
can you provide a minimal complete example for that please?