Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'origin/launch.next' into colerogers.fir…
…eperf
- Loading branch information
Showing
12 changed files
with
398 additions
and
61 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,32 @@ | ||
- Fixes a bug that disallowed setting customClaims and/or sessionClaims in blocking functions (#1199). | ||
- Add v2 Schedule Triggers (#1177). | ||
- Add performance monitoring triggers to v2 alerts (#1223). | ||
### Breaking Changes | ||
|
||
- Deprecated `allowInvalidAppCheckToken` option. Instead use | ||
`enforceAppCheck`. | ||
|
||
> App Check enforcement on callable functions is disabled by default in v4. | ||
> Requests containing invalid App Check tokens won't be denied unless you | ||
> explicitly enable App Check enforcement using the new `enforceAppCheck` option. | ||
> Furthermore, when enforcement is enabled, callable functions will deny | ||
> all requests without App Check tokens. | ||
- Dropped support for Node.js versions 8, 10, and 12. | ||
- Dropped support for Admin SDK versions 8 and 9. | ||
- Removed the `functions.handler` namespace. | ||
- `DataSnapshot` passed to the Firebase Realtime Database trigger now | ||
matches the `DataSnapshot` returned by the Admin SDK, with null values | ||
removed. | ||
- Removed `__trigger` object on function handlers. | ||
- Reorganized source code location. This affects only apps that directly import files instead of using the recommend entry points specified in the | ||
- Reworked the `apps` library and removed `lodash` as a runtime dependency. | ||
|
||
### Enhancements | ||
|
||
- Logs created with the `functions.logger` package in v2 functions | ||
are now annotated with each request's trace ID, making it easy to correlate | ||
log entries with the incoming request. Trace IDs are especially useful for | ||
cases where 2nd gen's concurrency feature permits a function | ||
to handle multiple requests at any given time. See | ||
[Correlate log entries](https://cloud.google.com/logging/docs/view/correlate-logs) to learn more. | ||
- `functions.logger.error` now always outputs an error object and is included in Google Cloud Error Reporting. | ||
- The logging severity of Auth/App Check token validation has changed from `info` to `debug` level. | ||
- Event parameters for 2nd generation functions are now strongly typed, permitting stronger TypeScript types for matched parameters. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
// The MIT License (MIT) | ||
// | ||
// Copyright (c) 2022 Firebase | ||
// | ||
// Permission is hereby granted, free of charge, to any person obtaining a copy | ||
// of this software and associated documentation files (the "Software"), to deal | ||
// in the Software without restriction, including without limitation the rights | ||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
// copies of the Software, and to permit persons to whom the Software is | ||
// furnished to do so, subject to the following conditions: | ||
// | ||
// The above copyright notice and this permission notice shall be included in all | ||
// copies or substantial portions of the Software. | ||
// | ||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
// SOFTWARE. | ||
|
||
import { expect } from "chai"; | ||
import * as remoteConfig from "../../../src/v2/providers/remoteConfig"; | ||
import * as options from "../../../src/v2/options"; | ||
|
||
describe("onConfigUpdated", () => { | ||
afterEach(() => { | ||
options.setGlobalOptions({}); | ||
}); | ||
|
||
it("should create a function with a handler", () => { | ||
const fn = remoteConfig.onConfigUpdated(() => 2); | ||
|
||
expect(fn.__endpoint).to.deep.eq({ | ||
platform: "gcfv2", | ||
labels: {}, | ||
eventTrigger: { | ||
eventType: remoteConfig.eventType, | ||
eventFilters: {}, | ||
retry: false, | ||
}, | ||
}); | ||
expect(fn.run(1 as any)).to.eq(2); | ||
}); | ||
|
||
it("should create a function with opts and a handler", () => { | ||
options.setGlobalOptions({ | ||
memory: "512MiB", | ||
region: "us-west1", | ||
}); | ||
|
||
const fn = remoteConfig.onConfigUpdated( | ||
{ | ||
region: "us-central1", | ||
retry: true, | ||
}, | ||
() => 2 | ||
); | ||
|
||
expect(fn.__endpoint).to.deep.eq({ | ||
platform: "gcfv2", | ||
availableMemoryMb: 512, | ||
region: ["us-central1"], | ||
labels: {}, | ||
eventTrigger: { | ||
eventType: remoteConfig.eventType, | ||
eventFilters: {}, | ||
retry: true, | ||
}, | ||
}); | ||
expect(fn.run(1 as any)).to.eq(2); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.