You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Wrap google cloud functions with a Proxy(). (#3035)
* Wrap google cloud functions with a Proxy().
Firebase wrappers such as `onRequest`, `onCreate`, etc return callable
handlers with some important additional data in properties which is
being used by `firebase-cli` while deploying the functions.
So when we wrap such functions naively, these properties are not
visible anymore. So I decided to circumvent it with a
`new Proxy(fn, { apply: ... })` trick.
This proxy object will redirect all property accesses to the original
function but calling behavior will be re-defined.
Also added some workarounds for firebase emulator (`firebase
emulators:start`)
- Need to wrap `fn.__emulator_func` too. See code comments.
- Need to create a new domain because unlike `functions-framework`,
firebase emulator doesn't create a domain.
Fixes#3023.
Also this commit removes a dependency on `@google-cloud/functions-framework` package
since it's used only for importing types but these types are also needed for TypeScript
users and we cannot force them to install an entired functions-framework
as a dependency.
Instead, I moved all the types from it right in this package and also add a
*runtime* dependency `@types/express`. Fixes#2997.
* Move @types/aws-lambda to dependencies.
It's not enough to include it only in `devDependencies` because without
it TypeScript users are getting type errors.
0 commit comments