aws / aws-sam-cli

CLI tool to build, test, debug, and deploy Serverless applications using AWS SAM
https://aws.amazon.com/serverless/sam/
Apache License 2.0
6.49k stars 1.17k forks source link

AppSync support #551

Closed gnemtsov closed 1 year ago

gnemtsov commented 6 years ago

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.

y4h2 commented 6 years 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.

gnemtsov commented 5 years ago

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.

MiMo42 commented 5 years ago

+1

mdrewt-zz commented 5 years ago

+1

alejandrocorrea commented 4 years ago

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?

eerenwong commented 4 years ago

+1

bramkoot commented 4 years ago

+1

hoangnguyencong-agilityio commented 3 years ago

+1

bramkoot commented 3 years ago

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.

es50678 commented 3 years ago

+1

rjmackay commented 3 years ago

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?

revmischa commented 3 years ago

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.

praneetap commented 2 years ago

@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 -

  1. We highly recommend you to use SAM Accelerate to test this in your development environment in the cloud. Here is a helpful video to learn more about it, and here is the installation instructions for the beta version. Please let us know if this helps with your testing needs.
  2. If testing in the cloud is not an option for you, we are considering adding plugin support if there is enough interest. Upvote and comment on this tracking issue, if building this as a plugin would be something you would be interested in instead.
jfuss commented 1 year ago

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

github-actions[bot] commented 1 year ago

⚠️COMMENT VISIBILITY WARNING⚠️

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.