apollographql / apollographql/apollo-server
ALB Event Handler Not Decoding Query String Parameters on GETs
- Dominant language
- TypeScript
- Stars
- 14k
- Forks
- 2k
- Avg merge
- 2d 14h
- Merged PRs (30d)
- 2
Description
### Issue Description
While trying to switch from an API Gateway fronted Lambda function running Apollo to an ALB, we encountered 400 errors when users made GET requests to the server.
The exception is thrown here:
https://github.com/apollographql/apollo-server/blob/main/packages/server/src/runHttpQuery.ts#L62
and I think it basically boils down to the fact that this:
https://github.com/apollographql/apollo-server/blob/main/packages/server/src/runHttpQuery.ts#L44
is not:
```
return decodeURIComponent(values[0]);
```
Is this user error because we have not URL decoded the query string parameter before sending the request down, or is Apollo server expected to handle this for us? It doesn't seem like this was required when running with the API Gateway handler.
### Link to Reproduction
I can't do this, as it requires provisioning AWS resources.
### Reproduction Steps
Create an ALB and send a GET request with a query string parameter that is URL encoded JSON content.
Contributor guide
Research direction
Start in packages/server/src/runHttpQuery.ts at the referenced lines and trace how GET query string values from an ALB request reach the parser. Reproduce with an ALB request containing URL-encoded JSON, then compare the behavior with the API Gateway handler. Done means the expected GET request is accepted without the reported 400 error and the relevant behavior is covered by the existing test structure, if available.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- aws, typescript
- Domain
- api, backend, cloud
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100