Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Help request: tRPC with vercel-edge #105

Closed
goetzrobin opened this issue May 31, 2023 · 2 comments
Closed

Help request: tRPC with vercel-edge #105

goetzrobin opened this issue May 31, 2023 · 2 comments

Comments

@goetzrobin
Copy link

Hey there! I hope this is the right place to ask for help.
I am trying to deploy an application with Nitro and tRPC with the vercel-edge preset.
I am getting a weird proxy error when I deploy it without making any changes to how tRPC is handled.

TypeError: 'getOwnPropertyDescriptor' on proxy: trap reported non-configurability for property 'setTimeout' which is either non-existent or configurable in the proxy target
    at (index.mjs:1:1261145)
    at (index.mjs:1:1270611)
    at (index.mjs:1:1272087)
    at (index.mjs:1:1246628)
    at (index.mjs:1:1271597)
    at (index.mjs:1:1273439)
    at (__nitro:middleware.js:1:17)

I think I need to use the fetchRequestHanlder as described in the tRPC documentation for Fetch / Edge Runtimes https://trpc.io/docs/server/adapters/fetch
They provide examples for Next.js, Remix, and SoldStart, but not Nuxt/Nitro.
Nitro uses IncommingMessage and ServerResponse, while the fetchRequestHandler expects a Request and returns a Response.

My initial, naive approach was to simply map back and forth between the two using these utilities I found for astro: https://github.com/withastro/astro/blob/2dca81bf2174cd5c27cb63cb0ae081ea2a1ac771/packages/integrations/vercel/src/serverless/request-transform.ts#L2

But again I am getting errors that seem to stem from Nitro using node-fetch under the hood? I am not experienced enough with the edge runtime or nitro to completely understand why it would not work and what needs to happen to make tRPC and Nitro on edge work together.

If anyone has any pointers or if anyone has a repo of a Nuxt/Nitro project that uses tRPC on the edge that would be awesome!

Thanks already for your help!

@goetzrobin goetzrobin changed the title tRPC with vercel-edge Help request: tRPC with vercel-edge May 31, 2023
@dominikjasek
Copy link

I was able to deploy it to Vercel using vercel-edge preset.

Repo: https://github.com/dominikjasek/nuxt3-trpc-demo
Deployed app: https://nuxt3-demo-ten.vercel.app/

@wobsoriano
Copy link
Owner

Hi, where you able to get this one fixed?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants