aws / aws-appsync-community

The AWS AppSync community
https://aws.amazon.com/appsync
Apache License 2.0
506 stars 32 forks source link

Unit testing of resolvers: only LambdaAuthIdentity supported for context, we need Cognito support #293

Open ben-elsen opened 1 year ago

ben-elsen commented 1 year ago

Hi,

I want to unit test my resolvers but when I provide a context object with an identity object that is formed according to cognito userpool authentication, I get the following error:

{
      '$metadata': {
        httpStatusCode: 200,
        requestId: 'd699c6c6-9a8e-4dc2-8bd7-70c98203e4d1',
        extendedRequestId: undefined,
        cfId: 'r-mlNekQJDDZrWKFs0byMvdNYSl2PBMUbkWSvKh7cvVgIDbJAj54iA==',
        attempts: 1,
        totalRetryDelay: 0
      },
      error: {
        message: 'Unrecognized field "sub" (class com.amazonaws.deepdish.common.identity.LambdaAuthIdentity), not marked as ignorable (one known property: "resolverContext"])\n' +
          ' at [Source: UNKNOWN; line: -1, column: -1] (through reference chain: com.amazonaws.deepdish.transform.model.MappingTemplateContext$MappingTemplateContextBuilder["identity"]->com.amazonaws.deepdish.common.identity.LambdaAuthIdentity["sub"])'
      }
    }