Skip to content

Commit

Permalink
fix: Fix TRPC batchign failure because of long URLs. Fixes #281 (#291)
Browse files Browse the repository at this point in the history
limiting the length of the URL for batched requests to prevent 431 errors
  • Loading branch information
kamtschatka authored Jul 13, 2024
1 parent 1396dd2 commit a222564
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 0 deletions.
1 change: 1 addition & 0 deletions apps/cli/src/lib/trpc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ export function getAPIClient() {
links: [
httpBatchLink({
url: `${globals.serverAddr}/api/trpc`,
maxURLLength: 14000,
transformer: superjson,
headers() {
return {
Expand Down
1 change: 1 addition & 0 deletions apps/web/lib/providers.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ export default function Providers({
httpBatchLink({
// TODO: Change this to be a full URL exposed as a client side setting
url: `/api/trpc`,
maxURLLength: 14000,
transformer: superjson,
}),
],
Expand Down
1 change: 1 addition & 0 deletions packages/shared-react/providers/trpc-provider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ function getTRPCClient(settings: Settings) {
links: [
httpBatchLink({
url: `${settings.address}/api/trpc`,
maxURLLength: 14000,
headers() {
return {
Authorization: settings.apiKey
Expand Down

0 comments on commit a222564

Please sign in to comment.