Closed 0x6368656174 closed 1 year ago
Latest commit: 4a98c0deb80e90d0f8006c38cd6c4fa401278557
The changes in this PR will be included in the next version bump.
Not sure what this means? Click here to learn what changesets are.
Click here if you're a maintainer who wants to add another changeset to this PR
This pull request is automatically built and testable in CodeSandbox.
To see build info of the built libraries, click here or the icon next to each commit SHA.
Latest deployment of this branch, based on commit 4a98c0deb80e90d0f8006c38cd6c4fa401278557:
Sandbox | Source |
---|---|
apollo-server-integration-aws-lambda | Configuration |
By the way. Looks like the ALBEventRequestHandler.ts
has the same problem, but I'm not sure, because I don't use ALB.
Thanks for the PR! I'll go ahead and get this merged. Looks like ALB is actually a bit more tricky and is based on the listener config as outlined here. I'll get back to the drawing board on that one to conditionally implement your fix.
The AWS API Gateway V1 has two sources of query search params:
queryStringParameters
multiValueQueryStringParameters
These sources contain the same parameters, but the last one supports parameters with equal names:
?a=...&a=...
.Example of AWS API v1 event
``` { resource: '/', path: '/', httpMethod: 'GET', headers: { Accept: '*/*', 'CloudFront-Forwarded-Proto': 'https', 'CloudFront-Is-Desktop-Viewer': 'true', 'CloudFront-Is-Mobile-Viewer': 'false', 'CloudFront-Is-SmartTV-Viewer': 'false', 'CloudFront-Is-Tablet-Viewer': 'false', 'CloudFront-Viewer-ASN': '9422', 'CloudFront-Viewer-Country': 'ID', 'content-type': 'application/json', Host: '...', 'User-Agent': 'curl/7.85.0', Via: '2.0 a9cfec72cfc71c81978b7bbf79189fdc.cloudfront.net (CloudFront)', 'X-Amz-Cf-Id': 'zpPgbS1-Al5p_t9vhZGYi-8944KbT1VZJB3fPxjL-iwYp3sR0yYJeg==', 'X-Amzn-Trace-Id': 'Root=1-63edd5d2-576b61c53d416be4759dc1ac', 'X-Forwarded-For': '..., ...', 'X-Forwarded-Port': '443', 'X-Forwarded-Proto': 'https' }, multiValueHeaders: { Accept: [ '*/*' ], 'CloudFront-Forwarded-Proto': [ 'https' ], 'CloudFront-Is-Desktop-Viewer': [ 'true' ], 'CloudFront-Is-Mobile-Viewer': [ 'false' ], 'CloudFront-Is-SmartTV-Viewer': [ 'false' ], 'CloudFront-Is-Tablet-Viewer': [ 'false' ], 'CloudFront-Viewer-ASN': [ '9422' ], 'CloudFront-Viewer-Country': [ 'ID' ], 'content-type': [ 'application/json' ], Host: [ '...' ], 'User-Agent': [ 'curl/7.85.0' ], Via: [ '2.0 ....cloudfront.net (CloudFront)' ], 'X-Amz-Cf-Id': [ 'zpPgbS1-Al5p_t9vhZGYi-8944KbT1VZJB3fPxjL-iwYp3sR0yYJeg==' ], 'X-Amzn-Trace-Id': [ 'Root=1-63edd5d2-576b61c53d416be4759dc1ac' ], 'X-Forwarded-For': [ '..., ...' ], 'X-Forwarded-Port': [ '443' ], 'X-Forwarded-Proto': [ 'https' ] }, queryStringParameters: { extensions: '{"persistedQuery":{"version":1,"sha256Hash":"ecf4edb46db40b5132295c0291d62fb65d6759a9eedfa4d5d612dd5ec54a6b38"}}' }, multiValueQueryStringParameters: { extensions: [ '{"persistedQuery":{"version":1,"sha256Hash":"ecf4edb46db40b5132295c0291d62fb65d6759a9eedfa4d5d612dd5ec54a6b38"}}' ] }, pathParameters: null, stageVariables: null, requestContext: { resourceId: '...', resourcePath: '/', httpMethod: 'GET', extendedRequestId: 'Aa5Y9G7-ywMFVYw=', requestTime: '16/Feb/2023:07:05:54 +0000', path: '/prod/', accountId: '...', protocol: 'HTTP/1.1', stage: 'prod', domainPrefix: 'xxxuw5r50g', requestTimeEpoch: 1676531154670, requestId: '7d30c334-54c0-4302-945e-a3e46382f211', identity: { cognitoIdentityPoolId: null, accountId: null, cognitoIdentityId: null, caller: null, sourceIp: '...', principalOrgId: null, accessKey: null, cognitoAuthenticationType: null, cognitoAuthenticationProvider: null, userArn: null, userAgent: 'curl/7.85.0', user: null }, domainName: '...', apiId: '...' }, body: null, isBase64Encoded: false } ```The
APIGatewayProxyEventRequestHandler.ts
tried to collect query parameters from both sources, that was the reason on such an error:It was happened because
extensions
param was set twice: fromqueryStringParameters
and frommultiValueQueryStringParameters
.This PR removes
queryStringParameters
supporting to avoid query params duplication.