Skip to content

fix for DataSnapshot.val() throwing error when source is null #1682

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 31, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions src/common/providers/database.ts
Original file line number Diff line number Diff line change
@@ -126,6 +126,9 @@ export class DataSnapshot implements database.DataSnapshot {
val(): any {
const parts = pathParts(this._childPath);
let source = this._data;
if (source === null) {
return null;
}
if (parts.length) {
for (const part of parts) {
if (source[part] === undefined) {

Unchanged files with check annotations Beta

import { REGION } from "./region";
import * as testLab from "./v1/testLab-utils";
const firebaseConfig = JSON.parse(process.env.FIREBASE_CONFIG);

Check warning on line 20 in integration_test/functions/src/index.ts

GitHub Actions / lint (18.x)

Unsafe assignment of an `any` value
admin.initializeApp();
// Re-enable no-unused-var check once callable functions are testable again.
// eslint-disable-next-line @typescript-eslint/no-unused-vars
async function callHttpsTrigger(name: string, data: any) {

Check warning on line 25 in integration_test/functions/src/index.ts

GitHub Actions / lint (18.x)

Unexpected any. Specify a different type
const url = `https://${REGION}-${firebaseConfig.projectId}.cloudfunctions.net/${name}`;

Check warning on line 26 in integration_test/functions/src/index.ts

GitHub Actions / lint (18.x)

Invalid type "any" of template literal expression

Check warning on line 26 in integration_test/functions/src/index.ts

GitHub Actions / lint (18.x)

Unsafe member access .projectId on an `any` value
const client = await new GoogleAuth().getIdTokenClient("32555940559.apps.googleusercontent.com");
const resp = await client.request({
url,
headers: {
"Content-Type": "application/json",
},
body: JSON.stringify({ data }),

Check warning on line 34 in integration_test/functions/src/index.ts

GitHub Actions / lint (18.x)

Unsafe assignment of an `any` value
});
if (resp.status > 200) {
throw Error(resp.statusText);
// Re-enable no-unused-var check once callable functions are testable again.
// eslint-disable-next-line @typescript-eslint/no-unused-vars
async function callV2HttpsTrigger(name: string, data: any, accessToken: string) {

Check warning on line 43 in integration_test/functions/src/index.ts

GitHub Actions / lint (18.x)

Unexpected any. Specify a different type
const getFnResp = await fetch(

Check warning on line 44 in integration_test/functions/src/index.ts

GitHub Actions / lint (18.x)

Unsafe assignment of an `any` value

Check warning on line 44 in integration_test/functions/src/index.ts

GitHub Actions / lint (18.x)

Unsafe call of an `any` typed value
`https://cloudfunctions.googleapis.com/v2beta/projects/${firebaseConfig.projectId}/locations/${REGION}/functions/${name}`,

Check warning on line 45 in integration_test/functions/src/index.ts

GitHub Actions / lint (18.x)

Invalid type "any" of template literal expression

Check warning on line 45 in integration_test/functions/src/index.ts

GitHub Actions / lint (18.x)

Unsafe member access .projectId on an `any` value
{
headers: {
Authorization: `Bearer ${accessToken}`,