aws / aws/aws-appsync-community
Bug: argument names passed to direct lambda seem to be incorrect
- Dominant language
- HTML
- Stars
- 507
- Forks
- 37
- PR merge metrics
- No merged PRs in 30d
Description
Assuming the following schema:
```graphql
schema {
query: Query
}
type Query {
test(a: String, b: String): String
}
```
Let's say I want to run the following query:
```graphql
query Test($userProvidedArg1: String, $userProvidedArg2: String) { # custom user arguments
test(a: $userProvidedArg1, b: $userProvidedArg2) # mapping to actual field arguments
}
# {variables: {userProvidedArg1: "Wololo", userProvidedArg2: "You know the rules, and so do I."}}
```
Here's what I get in `event`:
```json
{
# ...
"info": {
"selectionSetList": [],
"selectionSetGraphQL": "",
"fieldName": "test",
"parentTypeName": "Query",
"variables": {
"userProvidedArg1": "Wololo",
"userProvidedArg2": "You know the rules, and so do I."
}
}
}
```
As you can see, `event.info.variables` contains `userProvidedArg1` and `userProvidedArg2` (taken from the query), not the actual field argument names `a` and `b`, i. e. the mapping between field argument names & user-named arguments is lost. Furthermore, `userProvidedArg1` and `userProvidedArg2` are not mentioned anywhere else in the event. **How should I know which is which?**
This works if user-named arguments and field arguments have the same name, e. g. if the query is defined as follows:
```graphql
query Test($a: String, $b: String) {
test(a: $a, b: $b)
}
```
... but this doesn't seem like a reliable solution. Any ideas?
Contributor guide
Research direction
Start by reproducing the provided AppSync schema and query with a direct Lambda resolver, then inspect the emitted event.info.variables and field arguments. Done means the resolver event preserves or exposes the mapping between user-provided variable names and the field argument names a and b.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- aws
- Domain
- api, backend
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 30/100