sid88in / serverless-appsync-plugin

serverless plugin for appsync
MIT License
950 stars 186 forks source link

Need Sample for Javascript Resolver #549

Open sanjaycharles opened 1 year ago

sanjaycharles commented 1 year ago

Hi, Can we get an example of how to use the Javascript resolver and Javascript pipeline resolvers? We understand that the JavaScript resolvers only have one file that exports a request function and a response function...not sure on how to send them in via the plugin.

cgorrieri commented 1 year ago

Would love to have that too!

zocom-johan-kivi commented 1 year ago

Have you read the docs in alpha branch? I found them very useful.

Ive also found @bboure demo repo great as examples.

bboure commented 1 year ago

Thank you @zocom-johan-kivi

I should add this link in the doc.

owain68 commented 1 year ago

I got some mileage referring and deploying the aws javascript resolver examples

I kept getting a deployment error of Embedded stack arn:aws:cloudformation:xxxxxxxxxx was not successfully created: The following resource(s) failed to create: [GraphQlFunctionConfigurationMutationupdateStatus0].

Deploying this sample stack enabled me to debug my code by pasting my code into one of the todo resolvers and saving it, highlighting the error in the code. The only way I could find out as to what was throwing the error.

For future reference, you can't use new Date().toISOString() I changed it to util.time.nowISO8601()

O.

bboure commented 1 year ago

Thanks, @owain68

I created a tool that should help with debugging too

http://graphbolt.dev/

Check the mapping template tool

SonnyFishback commented 1 year ago

I would love to see examples as well