Minimal reproduction:
const pad = ''.padEnd(4096, ' '); // 2048 OK, 4096 FAIL, 8192 OK
const sqlQuery = `
SELECT *
FROM${pad}\`carto-demo-data.demo_tables.retail_stores\`
`;
data = vectorQuerySource({
accessToken: import.meta.env.VITE_CARTO_ACCESS_TOKEN,
connectionName: 'carto_dw',
sqlQuery,
filters
});
For URLs lengths of roughly 3000–7000, the TileJSON GET request succeeds, but subsequent tile loading requests fail with error 414 URI Too Long. After the URL length exceeds 7000 characters, @carto/api-client switches to POST requests with hashed versions of the SQL query, and tile requests succeed again.
The 7000 threshold was previously chosen based on the Fastly default limit of 8192 characters, but we could reduce this value in @carto/api-client. It appears that the infrastructure serving TileJSON has a higher limit than the infrastructure serving tile requests, so one succeeds and the other does not? I'm hoping to understand the actual limits before lowing the threshold arbitrarily, but the fix is likely to be a simple adjustment in:
|
/** |
|
* Fastly default limit is 8192; leave some padding. |
|
* @privateRemarks Source: @deck.gl/carto |
|
*/ |
|
export const DEFAULT_MAX_LENGTH_URL = 7000; |
Minimal reproduction:
For URLs lengths of roughly 3000–7000, the TileJSON GET request succeeds, but subsequent tile loading requests fail with error
414 URI Too Long. After the URL length exceeds 7000 characters,@carto/api-clientswitches to POST requests with hashed versions of the SQL query, and tile requests succeed again.The 7000 threshold was previously chosen based on the Fastly default limit of 8192 characters, but we could reduce this value in
@carto/api-client. It appears that the infrastructure serving TileJSON has a higher limit than the infrastructure serving tile requests, so one succeeds and the other does not? I'm hoping to understand the actual limits before lowing the threshold arbitrarily, but the fix is likely to be a simple adjustment in:carto-api-client/src/constants-internal.ts
Lines 7 to 11 in c677be5