Closed gnemtsov closed 1 year ago
For me, I usually write AppSync templates to invoke my lambda function. So for testing AppSync, I just test my lambda function locally and whether template pass parameter to lambda correctly with AppSync's UI.
I've built a Node.js script, which works like local AppSync: appsync-local.js. This script is a part of a small serverless boilerplate AppSync application. It uses JS-YAML and Velocityjs to read definitions and velocity mapping templates from CloudFormation template and GraphQL Schema. Then it creates Apollo Server instance to resolve GraphQL queries and mutations, and call local Lambda endpoint.
It's a bit hacky. It won't execute velocity functions. But it works great if you don't put much logic into mapping templates. Subscriptions are not fully supported yet, but I am going to fix that.
I hope my script will help someone to develop AppSync apps locally until aws-sam-cli starts to officially support AppSync.
+1
+1
My question is, what happens when I have several lambdas in different languages running locally whit sam, and I want to integrate them with appsync or amplify locally to test its operation with graphQL and its resolvers, without having to add api gateway. how do i do it?
+1
+1
+1
Based on some experience at a client with a NodeJS script build on on the one @gnemtsov linked, I started to work on this feature within some strict boundaries. Current state can be viewed at my fork repo.
The version I'm working on doesn't support subscriptions nor does it support Velocity templates, it basically works for Direct Lambda Resolvers. It also doesn't support nested resolvers. This is a version that I personally would use a lot, to locally test frontends with non-released backends that use AppSync.
Is the SAM team open to a PR for this feature? I'll work on some tests and tidying up the codebase in the coming week so hopefully I can send in some first version in a week or so.
+1
Any update on this? There's an open PR to add this functionality but it doesn't look like anyone has review this it at all?
I would really love this feature so I can do local development. My use case is CDK and prisma-appsync.
The local development story for serverless CDK apps is the biggest drawback to that development platform right now IMHO.
@rjmackay @revmischa @MiMo42 @bramkoot @y4h2 @es50678 @hoangnguyencong-agilityio @mdrewt @gnemtsov @eerenwong Thanks for your interest in this feature. We are hesitant to merge this today because with the current resources we would not be able to commit to maintaining this feature in the long run - maintain feature parity and fix issues with the implementation in a timely manner. Given the reaction we can see that this is important to the community and we recommend one of the two alternatives -
Thank you for the interest. We are still exploring a Plugin based solution for local development to allow the community to enable/extend features like this. Give that, we are closing this in favor of the Plugins tracking issue: https://github.com/aws/aws-sam-cli/issues/3265
Comments on closed issues are hard for our team to see. If you need more assistance, please either tag a team member or open a new issue that references this one. If you wish to keep having a conversation with other community members under this issue feel free to do so.
As far as I can see for now there is no AppSync support. It will be nice to be able to test GraphQL queries locally with local lambda as data sources. Are there any plans to implement it? What is the best option for now for developing AppSync applications? Setup local apollo server and try to connect it with local lambdas? Appreciate any advice or thoughts about that.