ProtectedconstructorConstructs a GcpCloudFunctionsHttpAdapter instance.
This constructor is protected and is intended to be used via the static create method.
The application blueprint for dependency resolution.
Protected ReadonlyblueprintProtected ReadonlyhooksProtected ReadonlyloggerProtected ReadonlymiddlewareProtected ReadonlyresolvedProtectedbuildBuild the raw response.
The event context.
OptionaleventHandler: AdapterEventHandlerType<IncomingHttpEvent, OutgoingHttpResponse>
The event handler to be run.
The raw response wrapper.
ProtectedeventProtected
Handles an incoming HTTP request and sends it through the adapter's event pipeline.
The raw GCP Cloud Functions HTTP request object.
The raw HTTP response object.
A promise resolving to the ServerResponse.
ProtectedexecuteExecute the event handler lifecycle hooks.
The hook to execute.
The event handler to be run.
ProtectedexecuteExecute adapter lifecycle hooks.
The hook's name.
Optionalcontext: GcpCloudFunctionsHttpAdapterContext
The event context.
Optionalerror: any
The error to handle.
ProtectedhandleHandle error.
The error to handle.
The event context.
The raw response.
ProtectedhandleHandle the event.
The event context.
The event handler to be run.
The raw response wrapper.
ProtectedmakeCreate pipeline options for the Adapter.
The pipeline options for transforming the event.
ProtectedonLifecycle hook for adapter initialization.
The platform owns the process, so this only guards the runtime environment and fires the
onStart hooks; it does NOT bind process signals or a server (the runtime manages shutdown).
ProtectedresolveProtectedresolveBoots the application and returns the HTTP function handler.
Register the returned handler with the Functions Framework:
import * as functions from '@google-cloud/functions-framework'
functions.http('stone', await StoneFactory.create({ ...blueprint }).run())
A promise resolving to the (req, res) handler invoked per request.
ProtectedsendSend the raw event through the destination.
The event context.
The event handler to be run.
Platform-specific response.
ProtectedvalidateValidate the context and event handler.
The context to validate.
The event handler to validate.
StaticcreateCreates a new GcpCloudFunctionsHttpAdapter instance.
The application blueprint.
A new instance of GcpCloudFunctionsHttpAdapter.
GCP Cloud Functions HTTP Adapter for the Stone.js framework.
The
GcpCloudFunctionsHttpAdapterintegrates a Google Cloud Functions HTTP function (the Functions Framework(req, res)signature) with the Stone.js framework. It converts the incoming Express-flavoured request into anIncomingHttpEvent, runs it through the kernel, and writes theOutgoingHttpResponseback onto the response object.Unlike the Node HTTP adapter, it does NOT create or own an HTTP server: the platform owns the process lifecycle and the socket.
run()returns the handler that the Functions Framework invokes per request.Remarks
Cloud Run runs a container with a normal long-running HTTP server, so it does not need this adapter, use
@stone-js/node-http-adapteras-is. This adapter is specifically for the event-driven HTTP functions runtime (1st and 2nd gen Cloud Functions).