tRPCttRPC
Powered by
FluXF
tRPC•7mo ago•
1 reply
FluX

Type errors when deploying to Vercel using new client integration

Hey, wondering if anyone else had a similar issue and found a fix for it.

I have a Turborepo monorepo with a Next.js app and a trpc package.
When trying to deploy to Vercel, I'm getting type errors like
Property 'map' does not exist on type '() => never'
Property 'map' does not exist on type '() => never'
. The relevant code snippet would be this:

export const Component = () => {
  const trpc = useTRPC()
  const { data, isLoading } = useQuery(trpc.my.endpoint.queryOptions())

  return (
    <div>
      {!isLoading && data && data.length && (
        <div>
          {data.map((c, i) => (
            /* ... */
          ))}
        </div>
      )}
    </div>
  )
}
export const Component = () => {
  const trpc = useTRPC()
  const { data, isLoading } = useQuery(trpc.my.endpoint.queryOptions())

  return (
    <div>
      {!isLoading && data && data.length && (
        <div>
          {data.map((c, i) => (
            /* ... */
          ))}
        </div>
      )}
    </div>
  )
}


The error doesn't make any sense to me. My guess is that the types of my router are not available in the Vercel environment and thus the type of
data
data
is wrong.
Locally the build works without problems.

Anyone perhaps knows a fix for this? Thanks :)
tRPCJoin
Move Fast & Break Nothing. End-to-end typesafe APIs made easy.
5,015Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements

Similar Threads

Type errors in lambda integration
ortonomyOortonomy / ❓-help
3y ago
Errors while running mutations when deploying CT3A using SST
NotLuksusNNotLuksus / ❓-help
3y ago