apollo-server icon indicating copy to clipboard operation
apollo-server copied to clipboard

Call for maintainers: apollo-server-cloud-functions

Open glasser opened this issue 3 years ago • 1 comments

As described in the roadmap, Apollo Server 4 will shift from the model of "9 web framework integrations maintained by a team who only uses one of them and nope, you can't create your own" to "a stable web framework integration API that anyone can use for their favorite web framework".

As part of this, the Apollo Server core team is no longer planning to maintain apollo-server-cloud-functions. We think users of Google Cloud Functions are best served if their framework integration is maintained by a team of people who use Google Cloud Functions every day.

This is where you come in! Do you love Google Cloud Functions? Do you use it with Apollo Server? Would you like to be part of a team of community members who maintain apollo-server-cloud-functions?

If so, chime in below! We'd love to find a group of people who will maintain the Apollo Server 4 version of apollo-server-cloud-functions, and to help us maintain the section of the Apollo Server docs that shows how to use Apollo Server with Google Cloud Functions.

We expect that maintaining this package will be more straightforward than maintaining an Apollo Server integration today, because its only responsibility will be translating Google Cloud Functions' HTTP request and response objects to the formats used by Apollo Server's new API.

At the time that this issue is opened, we are actively looking for interested collaborators; however, the API you'll be implementing isn't yet ready. We can use this issue to get a team together who can get started at some point between an initial alpha release of the new @apollo/server package and the final v4.0.0 release.

Some Google Cloud Functions-specific notes:

  • This project might end up not needing to actually involve maintaining an npm package at all! @apollo/server will export an Express-compatible middleware, and will have built-in support for the special error handling that leads to boilerplate in the serverless integrations today. It is pretty likely that using Apollo Server with Cloud Functions will just require some documentation to show how to use @apollo/server directly with no extra CF-specific handler required. However, it still makes sense for there to be Cloud Functions users who maintain the docs/examples/etc.
  • We do actually use Apollo Server with GCF a bit at Apollo, so we can definitely be part of this team, but it's always great to have more community involvement.

glasser avatar Jan 25 '22 21:01 glasser

If you're reading this, we're ready for you! We feel that Apollo Server 4's API is in a good place for integration authors to start building against. We've written a step-by-step guide and built out a couple of working examples.

If you're here and you're interested, please ping us here on the issue and let us know! I'm happy to answer any questions and help however I'm able.

-- Trevor

trevor-scheer avatar Jul 28 '22 23:07 trevor-scheer

Apollo Server v4.0.0 will be published to latest soon!

We now have a community GH org where people can create an integration repo as well as an NPM scope for publishing integration packages. If you'd like to be involved over there, feel free to get in touch with me. This is not a requirement for building and publishing an integration, but we wanted to offer a sensible place for these community-maintained packages to live.

https://github.com/apollo-server-integrations https://www.npmjs.com/search?q=%40as-integrations

trevor-scheer avatar Oct 10 '22 17:10 trevor-scheer

I added support GCP into my library Serverless Adapter, and because it already had support for Apollo Server, now you can deploy Apollo Server to Cloud Functions too.

See the docs about the integration or a working example

H4ad avatar Dec 26 '22 22:12 H4ad

Been experimenting with the suite of Google Cloud products for some time now, and after some days I managed to hack together a POC for how Apollo Server deployed to Google Cloud Functions would look like. It is largely based on the work that was already done in @as-integrations/next. You can find the repository with the source here, and a working example of the deployed function here.

I would also be interested in becoming a maintainer of the community integration if possible. There are a few quirks that I would try to solve with the help of Apollo and community members before making a release of the integration:

  • Google Cloud Functions require that you specify a entryPoint flag during deployment that must match the string value used to name the handler function when using @google-cloud/functions-framework. The way I currently solve this is by sourcing the value of an environment variable, and injecting it on both the bundled output, and on the deployment command so they match. I don't really know how this looks like when/if this becomes a @as-integrations/google-cloud-functions package.
  • If we do opt for not writing the integration, but maintaining the docs for how projects should be setup for Google Cloud Functions deployments, there should be some key informations about things like Gen1 & Gen2 deployments, setting up correct permissions for deployment, and the usage of the gcloud CLI for deployments (both locally and on CI, since their official Github Action does not yet support Gen2 deployments, so we end up falling back to running the gcloud CLI on the CI environment).

ernestoresende avatar Jan 02 '23 03:01 ernestoresende

Thanks @ernestoresende! I've added you to the org and created a google-cloud-functions team for you. You should be able to transfer the repository there if you choose.

I am by no means a GCF expert, and it sounds like you've spent some time thinking about the build / naming problem. I'd welcome you to take the approach that you feel is best and invite feedback from the community. Maybe both approaches are reasonable and we can provide code or guidance accordingly? These integrations are (by design) generally quite simple, so if it makes sense to solve this integration with a snippet and documentation then that's not too surprising!

Send me another email or respond here with your npmjs handle and I'll get you set up with an NPM token for publishing if you think you'll be publishing a package under the @as-integrations scope.

trevor-scheer avatar Jan 10 '23 17:01 trevor-scheer

Thank you @trevor-scheer. I've been quite busy during the last week, but I started some work on the repo, and experimented with some ways of making it work as a published package, while also providing an example directory in the repo with recommended defaults for bundling the function and deploying to Google Cloud.

In the near future, when the package is published, I'll probably open a PR for this repo adding deployment documentation similar to the existing Heroku and Lambda articles.

ernestoresende avatar Jan 12 '23 14:01 ernestoresende

Oh, almost forgot, here's the npmjs handle: https://npmjs.com/~thisisernesto

ernestoresende avatar Jan 12 '23 15:01 ernestoresende

Sounds great! Feel free to ping me from that repo if there's anything I can help with. Let me know when you decide to publish!

For other interested maintainers, the repo is here: https://github.com/apollo-server-integrations/apollo-server-integration-google-cloud-functions

trevor-scheer avatar Jan 13 '23 18:01 trevor-scheer

What's the current state of this integration? Is it a work-in-progress?

ianyoung avatar Feb 03 '23 12:02 ianyoung

I've been slowly working on it on my free time and trying to smooth edge-cases and documentation, but all seems to indicate that it's currently in working state and only pending publishing (which, at the moment, is entirely my fault, as Trevor already gave me the necessary permissions and credentials to publish it).

I'll test it once more, both locally and on GCP, to see if all checks out, and probably publish an alpha release by EOD so early users can start using it. I'll also open the repository on the organization scope (which is currently private, if you were visiting the link above and getting a 404, that's probably why).

ernestoresende avatar Feb 03 '23 13:02 ernestoresende