t3-oss / create-t3-app

The best way to start a full-stack, typesafe Next.js app
https://create.t3.gg
MIT License
24.77k stars 1.14k forks source link

bug: Vercel Standard Deployment Proteciton breaks tRPC #1648

Closed nemanjastanic closed 9 months ago

nemanjastanic commented 10 months ago

Provide environment information

System: OS: macOS 14.0 CPU: (8) arm64 Apple M1 Memory: 107.31 MB / 16.00 GB Shell: 5.9 - /bin/zsh Binaries: Node: 18.17.1 - ~/.nvm/versions/node/v18.17.1/bin/node Yarn: 1.22.19 - /opt/homebrew/bin/yarn npm: 9.6.7 - ~/.nvm/versions/node/v18.17.1/bin/npm pnpm: 8.6.2 - /opt/homebrew/bin/pnpm bun: 0.7.3 - /opt/homebrew/bin/bun

Describe the bug

When you use Standard Deployment Protection (default and recommended by Vercel), VERCEL_URL is now undefined. This breaks tRPC since the getUrl function falls back to http://localhost:3000.

This is due to a recent change (Vercel Docs)

Reproduction repo

Unnecessary

To reproduce

  1. Create a new app using create-t3-app
  2. Deploy it to Vercel
  3. Make sure deployment protection stays on Standard Protection
  4. All tRPC requests will result in a server-side exception

Additional information

No response

sscotth commented 10 months ago

Looks like a dupe of #1639

juliusmarminge commented 9 months ago

server calls no longer use http so i believe this issue is "automatically" resolved - reopen if you still have issues