bug: AppSync: the resolver context's info.selectionSetGraphQL is missing in both runtimes, and info.variables carries the field's arguments instead of the operation's variables
#89
mattiarossi
started this conversation in
Bugs (AWS)
Replies: 1 comment
|
One correction to the report above: the info.variables observation (the field's resolved arguments instead of the operation's variables) was made on 2026.10.7 and dev958 on a pipeline function. On localstack/localstack:dev 2026.11.0.dev993 it is fixed: ctx.info.variables is {"n": 1} for query Probe($n: Int), with ctx.arguments {"first": 1}, in a unit resolver, in a pipeline resolver and in a pipeline function alike. The missing info.selectionSetGraphQL is the only item of this report; it is still undefined in all three places on dev993. |
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Is there an existing issue for this?
selectionSetGraphQLpresent,selectionSetListabsent)Current behavior
On LocalStack the resolver context's
infoobject has exactly four keys, in the VTL runtime and inAPPSYNC_JSalike:fieldName,parentTypeName,variables,selectionSetList.info.selectionSetGraphQLdoes not exist:$util.toJson($context.info.selectionSetGraphQL)givesnullin VTL,ctx.info.selectionSetGraphQLisundefinedin JS and the key is absent fromObject.keys(ctx.info).selectionSetListis correct (the field paths, nested ones asparent/child), but it carries no arguments, so a nested field's argument is gone.The case this breaks: a resolver that stands in front of another GraphQL engine (a Lambda data source proxying to a GraphQL server over a database, as Amplify Gen 2 applications with a custom data layer do) builds its downstream query from
selectionSetGraphQL.A client query such as
{ partners(first: 1) { id organizations(orderBy: CODE_ASC) { code } } }reaches the downstream engine with
orderBy: CODE_ASCon AWS and without it on LocalStack: the nested field has no resolver of its own, so the parent's resolver is the only place that argument can be honoured, and it only ever sees it inselectionSetGraphQL.Reproduction, one API
The resolver below plays the proxy: it reads the nested
orderByfrominfo.selectionSetGraphQLand orders its result accordingly, and it echoesinfoin a field so the context can be seen.schema.graphqlpartners.js(Query.partners,APPSYNC_JS1.0.0, data source NONE)The answer on LocalStack 2026.11.0.dev993 (run 2026-11-15):
{"data": {"partners": [{"id": "1", "organizations": [{"code": "b"}, {"code": "c"}, {"code": "a"}], "info": "{\"orderBy\":null,\"selectionSetGraphQL\":null,\"selectionSetList\":[\"id\",\"organizations\",\"organizations/code\",\"info\"],\"variables\":{\"n\":1},\"infoKeys\":[\"fieldName\",\"parentTypeName\",\"variables\",\"selectionSetList\"]}"}]}}organizationsb, c, a: theorderBynever reached the resolvera, b, cinfo.selectionSetGraphQLundefined;nullthrough$util.toJsonin VTL)"{\n id\n organizations(orderBy: CODE_ASC) {\n code\n }\n info\n}"info.selectionSetList["id","organizations","organizations/code","info"]Object.keys(info)fieldName,parentTypeName,variables,selectionSetListselectionSetGraphQLThe same was observed first on an application's pipeline resolver (a custom VTL request template forwarding
$util.toJson($context.info.selectionSetGraphQL)to a Lambda data source, and the pipeline function swapped toAPPSYNC_JSwith the wholectxdumped): the same four-keyinfoin both runtimes.On that pipeline function, on 2026.10.7 and dev958,
info.variablesheld the field's resolved arguments ({"first": 1}) instead of the operation's variables ({"n": 1}); the unit resolver above shows the variables correct on dev993, so that part may be fixed or specific to pipeline functions.Expected behavior
The AWS resolver context reference ("Resolver context object reference", the
infosection) listsselectionSetGraphQL: "a string representation of the selection set, formatted as GraphQL schema definition language (SDL); fragments are not merged into the selection set, aliases are preserved, arguments are preserved".Both runtimes expose it (
$context.info.selectionSetGraphQL,ctx.info.selectionSetGraphQL). With it, the reproduction answersa, b, c.The provider already walks the selection AST to build
selectionSetList; printing the field node's selection set back to GraphQL source at context build is the missing step.How are you starting LocalStack?
Docker Compose (LocalStack Pro,
localstack/localstack:dev2026.11.0.dev993, also seen on 2026.10.7;PERSISTENCE=1), the AWS CLI andcurlfrom a workstation. The reproduction above creates one API and is removed withaws appsync delete-graphql-api --api-id "$A".Why it matters
A Lambda data source that proxies to another GraphQL engine forwards
selectionSetGraphQLto build its downstream query.On LocalStack it receives nothing and can only rebuild the selection from
selectionSetList, which drops every nested field argument (orderBy,first,filteron a nested connection), every alias and every fragment.In our application two client queries carry a nested
organizations(orderBy: CODE_ASC): on AWS the list is ordered, on LocalStack it is not, and no resolver-side workaround restores it without coupling the resolver to its clients.Because an earlier provider (v2.0.2, #8362) had the string, this reads as a regression of a rewrite rather than a feature never built.
Environment
localstack/localstack:dev, Pro token), first seen on 2026.10.7 (Pro)All reactions