1 Answer
- Newest
- Most votes
- Most comments
1
I found the solution,
As I am using data directly from the lambda resolver's context and the context arguments only, there is no need for other Dynamodb data source to be bound. So I switch to NoneDataSource and have the following, then it works.
import { util } from '@aws-appsync/utils';
export function request(ctx) {
return {
payload: ctx.args
}
}
export function response(ctx) {
const {identity, args} = ctx
if (!!(identity?.resolverContext?.user)) {
if (identity.resolverContext.user != args.user) {
return util.unauthorized()
}
}
}
As you can see, the request needs to comply with the data source format, the payload field must be specified for the NoneDataSource (good for just passing data), while the version and operation fields, etc need to be specified for the Dynamodb data source. That was why my resolver for the subscription did not work.
Relevant content
- asked 7 years ago
- AWS OFFICIALUpdated 2 years ago
- AWS OFFICIALUpdated 2 years ago
