Skip to content

How to evaluate resolver changes to $context.stash? #4222

Answered by gxxcastillo
gxxcastillo asked this question in Q&A
Discussion options

You must be logged in to vote

I got it working using appsync-template-tester instead of client.evaluateMappingTemplate:

import Parser from 'appsync-template-tester';

const template = fs.readFileSync('./createUser.vtl', 'utf8')
const context = fs.readFileSync('./createUserMockContext.json', 'utf8')

const parser = new Parser(template);
parser.resolve(contextMock);

With that in place, I can access the updated context and stash with parser.context and parser.stash.

Replies: 2 comments

Comment options

You must be logged in to vote
0 replies
Answer selected by gxxcastillo
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
1 participant