![]() This worked, but added an extra overhead to process webhooks, an additional component that can break, as well as an extra piece of infrastructure to maintain (yeah, I lied in the beginning of this article, even serverless functions require you to deal with at least a bit of infrastructure). ![]() One solution we had for a while was to call a Google Cloud Function over HTTP from the Cloudflare Worker, and that Cloud Function could itself use the Google Cloud Node.js SDK to call Pub/Sub. See Google Cloud authentication strategies. Note that Google does offer a pure JavaScript SDK (intended for browser usage) known as GAPI which would syntactically be compatible with Cloudflare Workers, but it only supports OAuth or API key authentication, and not service account, which is necessary in our backend case. Cloudflare Workers essentially brought Webpack to the backend, as well as all the limitations we usually have with browsers.Īnd because we depend on Google Cloud Pub/Sub, and the Google Cloud SDK only has a Node.js client for Pub/Sub (not plain JavaScript), we can’t use that directly from Cloudflare Workers. This means all the usual modules we would normally import are not there, and we can’t easily npm install Node.js dependencies. ![]() Most of the JavaScript backend ecosystem is built around Node.js, but Cloudflare Workers is not.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |