question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Batching - safeguard for max url length

See original GitHub issue

👋 Do you want to pick this up? See https://github.com/trpc/trpc/issues/506#issuecomment-1016626260


Challenge described:

  • Max characters for a url is ~2k characters (I think)
  • Currently the batching lumps everything in a request as /api/trpc/posts.byId,posts.byId.query,posts.byId?batch=1&input=${encodeURIComponent(JSON.stringify(input))}

This could potentially lead to situations where the client constructs a url that is too long.

A few things we could do to prevent this

  • Change the way we build the query
    • Given query, this could be built like like /api/trpc/3*posts.byId?batch=x
  • Make sure the data loader splits up the queries into separate requests when exceeding limit of x
  • What I don’t want to do is to use anything but GET for queries

Refs in the code


I think the best interface way of handling this is to allow doing httpBatchLink({ maxURILength: 2048 }).

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:4
  • Comments:10 (8 by maintainers)

github_iconTop GitHub Comments

1reaction
KATTcommented, Jan 19, 2022

Yes! Here’s some rough steps:

Read more comments on GitHub >

github_iconTop Results From Across the Web

Maximum length of HTTP GET request - Stack Overflow
Most web servers have a limit of 8192 bytes (8 KB), which is usually configurable somewhere in the server configuration.
Read more >
Long HTTP GET requests and a Uri max length constraint
Hello,. We've got a requirement on our project (where we use WCF Data Services 5.0) to allow consumers to send OData requests with...
Read more >
Enforcement of URL length limit for Web API requests
Enforcement of URL length limit for Web API requests ... Requests to the Web API are subject to a 16,000-character limit for the...
Read more >
Configuring the maximum allowed URL length for an HTTP ...
The BIG-IP ASM system checks the URL length of HTTP requests as part of HTTP protocol compliant enforcement. The system uses the ecard_max_http...
Read more >
SharePoint Online: Find All Files Exceeding Maximum URL ...
This PowerShell script scans Excel files in all document libraries in a given site collection, checks if any file URL length exceeds the...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found