How does the whole GraphQL + Services + Lambda Serverles work?

Original question from Loren here #282:

This is unclear to me and I imagine others. Are the services separate lambda functions? And are they Apollo federation services? “external GraphQL requests” meaning the client sending requests?

And a response from @rob:

The services are rolled into the lambda function(s) that reference them. For example the GraphQL endpoint will end up including all of the service code that it references in one single Lambda function. If you were to write a custom function then that would be a second Lambda that only includes the services it references as well. We have an illustration in the tutorial that attempts to depict it (the SDL and Service are inside the Lambda, but the service “peeks” out just a bit to access the outside world).

All this is happening via Redwood’s implementation of Prisma2 and Apollo GraphQL Lambda Server.

If you want to see this in action within your Redwood App, take a look at our build docs. From your App root run this on the command line:
$ yarn rw build api

Then look in the directory api/dist/functions to see the Lambda-ready functions.

1 Like