4

I am fairly new to GraphQL and have been using AWS AppSync service for GraphQL APIs. I use AWS Cognito for authentication/authorization, some Lambda functions and also have serverless RDS instance that is connected to my API. My question is:

How can I or is there a way to migrate from AppSync to Apollo GraphQL implementation in Javascript with least amount of rewriting the code and keeping the data sources as they are?

Reasons:

  1. No support for versioning in AppSync. I am unable to find way to revert back to an old version of my API. Currently, I backup my API by downloading the schema.json from AppSync and backup all my resolvers in a text file.
  2. If code gets bigger, browser gets unresponsive and takes good amount of time to load for the first time.
  3. Helper functions in $util serves great but at some points, I find it lacking somethings that I want to do differently. To work around this, I use Lambda functions. Therefore, no support for adding custom modules or libraries in AppSync.
  4. Sometimes, testing and debugging a resolver can be really frustrating. I am used to print on console and I find it really helpful.

Any help would be much appreciated.

2
  • You are able to create Lambda Functions with modules, see AWS Lambda deployment package in Node.js, in the Lambda Developer Guide. Commented Jul 13, 2020 at 14:22
  • Sorry if I wasn't clear. What I meant by it was that there is no support for adding more helper functions, or modules or libraries in AppSync. Commented Jul 13, 2020 at 14:47

1 Answer 1

2

This isn't really an answer on migration but more of some thoughts on your issues that you might consider.

  1. Versioning. You might explore working offline using either serverless or AWS's own SAM - that way you'd be able to version your configs.

  2. Browser gets unresponsive - My guess this is not going to get resolved by migration - perhaps there is a design issue that could be improved here.

  3. Helper functions in $util - I understand though you can often find workarounds. VTL is pretty powerful (though annoying sometimes) and I've never had to rely on a Lamdba except to do things far beyond the scope of any helper (running JSON Schema validators for ex). But I can see how it would be nice to write your own for sure.

  4. Debugging - Going offline with one of the solutions in #1 is going to help there. I don't have much experience with SAM but I use serverless very extensively and the appsync offline options offer debugging.

Perhaps this helps.

Sign up to request clarification or add additional context in comments.

2 Comments

Thank you for your valuable suggestions. Yes, I am wanting to work offline and I will look into these framworks. Regarding your comment about the browser issue, I break down my API into smaller part but it does not work all the time. By that I mean some APIs cannot be broken down and are already optimized. Regarding $util, I posted this question a while ago. Although it's such an easy task but I was not able to find any solution but to create a Lambda function.
@Myz I posted an answer to your $util issue. Admittedly that one is a pain because of all the quotes and escaping. As far as your api though.... how is migrating to a different backend going to change the structure of your api? Or rather - what kind of structure will you be able to do on standalone Apollo that you cannot do on AppSync?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.