aws / aws/aws-appsync-community

Types for AppSync lambda resolver don't match

Open
#227 1 comment 6 reactions 0 assignees View on GitHub
Dominant language
HTML
Stars
507
Forks
37
PR merge metrics
No merged PRs in 30d

Description

Hi, I'm using AppSync + GraphQL + Lambda Resolvers through Amplify (v8.3.0). I'm using TypeScript to write my lambda resolver, but the type of `event` seems slightly different from the definition for `AppSyncResolverEvent` in [`@types/aws-lambda`](https://github.com/DefinitelyTyped/DefinitelyTyped/blob/ee1993e96c9e4a5c335361b1a2c7cb706bc9d4ef/types/aws-lambda/trigger/appsync-resolver.d.ts#L47).

The actual event object looks like:
```
{
"typeName": "Mutation",
"fieldName": "createInitialMedia",
"arguments": {
"projectId": "07a46207-19fb-439c-91a8-490e09dc86f7"
},
"identity": {
...
},
"source": null,
"request": {
...
},
"prev": {
"result": {}
}
}
```

Is `AppSyncResolverEvent` the wrong type to be using here? Or is this event object format specific to Amplify?

`schema.graphl` for reference:

```
type Mutation {
createInitialMedia(projectId: String!): Media
@function(name: "mediaApi-${env}")
}
```

Contributor guide

Open the contributing guide

Research direction

Compare the Amplify AppSync Lambda event shown in the issue with AppSyncResolverEvent in @types/aws-lambda/trigger/appsync-resolver.d.ts at line 47, using schema.graphl as context. Determine whether the declared type or the reported event shape is incorrect, and document or correct the matching type definition.

Written by the indexing model from the issue text.

Assessment

Tech stack
aws, graphql, typescript
Domain
api, backend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.