Skip to content
Merged
Show file tree
Hide file tree
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
1 change: 0 additions & 1 deletion Node-1st-gen/github-to-slack/functions/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
'use strict';

const functions = require('firebase-functions/v1');
const fetch = require('node-fetch');
const crypto = require('node:crypto');
const secureCompare = require('secure-compare');

Expand Down
1 change: 0 additions & 1 deletion Node-1st-gen/github-to-slack/functions/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
"eslint-plugin-promise": "^7.2.1",
"firebase-admin": "^13.0.2",
"firebase-functions": "^6.3.0",
"node-fetch": "^2.6.7",
"secure-compare": "^3.0.1"
},
"devDependencies": {
Expand Down
3 changes: 0 additions & 3 deletions Node-1st-gen/github-to-slack/functions/pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 1 addition & 2 deletions Node-1st-gen/minimal-webhook/functions/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
'use strict';

const functions = require('firebase-functions/v1');
const fetch = require('node-fetch');

// This is the URL that we will callback and send the content of the updated data node.
// As an example we're using a Request Bin from http://requestb.in
Expand All @@ -33,7 +32,7 @@ exports.webhook = functions.database.ref('/hooks/{hookId}').onCreate(async (snap
});

if (!response.ok) {
throw new Error(`HTTP Error: ${response.statusCode}`);
throw new Error(`HTTP Error: ${response.status}`);
}
functions.logger.log('SUCCESS! Posted', snap.ref);
});
3 changes: 1 addition & 2 deletions Node-1st-gen/minimal-webhook/functions/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@
"dependencies": {
"eslint-plugin-promise": "^7.2.1",
"firebase-admin": "^13.0.2",
"firebase-functions": "^6.3.0",
"node-fetch": "^2.6.7"
"firebase-functions": "^6.3.0"
},
"devDependencies": {
"eslint": "^8.57.1"
Expand Down
3 changes: 0 additions & 3 deletions Node-1st-gen/minimal-webhook/functions/pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
*/
"use strict";
const path = require("path");
const fetch = require("node-fetch");
const functions = require('firebase-functions/v1');
const {initializeApp} = require("firebase-admin/app");
const {getFunctions} = require("firebase-admin/functions");
Expand Down Expand Up @@ -80,16 +79,13 @@ exports.backupApod = functions
logger.info(`Fetched ${picUrl} from NASA API for date ${date}.`);

const picResp = await fetch(picUrl);
const imageBuffer = await picResp.arrayBuffer();
const buffer = Buffer.from(imageBuffer);
const dest = getStorage()
.bucket(BACKUP_BUCKET)
.file(`apod/${date}${path.extname(picUrl)}`);
try {
await new Promise((resolve, reject) => {
const stream = dest.createWriteStream();
picResp.body.pipe(stream);
picResp.body.on("end", resolve);
stream.on("error", reject);
});
await dest.save(buffer);
} catch (err) {
logger.error(`Failed to upload ${picUrl} to ${dest.name}`, err);
throw new HttpsError("internal", "Uh-oh. Something broke.");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,7 @@
"dependencies": {
"eslint-plugin-promise": "^7.2.1",
"firebase-admin": "^13.0.2",
"firebase-functions": "^6.3.0",
"node-fetch": "^2.6.7"
"firebase-functions": "^6.3.0"
},
"devDependencies": {
"eslint": "^8.57.1",
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion Node-1st-gen/remote-config-diff/functions/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@

const functions = require('firebase-functions/v1');
const admin = require('firebase-admin');
const fetch = require('node-fetch');
const jsonDiff = require('json-diff');

admin.initializeApp();
Expand Down
1 change: 0 additions & 1 deletion Node-1st-gen/remote-config-diff/functions/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
"firebase-admin": "^13.0.2",
"firebase-functions": "^6.3.0",
"json-diff": "^1.0.3",
"node-fetch": "^2.6.9",
"request": "^2.88.2",
"request-promise": "^4.2.5"
},
Expand Down
3 changes: 0 additions & 3 deletions Node-1st-gen/remote-config-diff/functions/pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 0 additions & 3 deletions Node-1st-gen/testlab-to-slack/functions/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,6 @@

const functions = require('firebase-functions/v1');

// The node-fetch library to send web requests to Slack.
const fetch = require("node-fetch");

/**
* Posts a message to Slack via a Webhook
* @param {string} title
Expand Down
3 changes: 1 addition & 2 deletions Node-1st-gen/testlab-to-slack/functions/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,7 @@
"eslint": "8",
"eslint-plugin-promise": "^7.2.1",
"firebase-admin": "^13.0.2",
"firebase-functions": "^6.3.0",
"node-fetch": "^2.0.0"
"firebase-functions": "^6.3.0"
},
"devDependencies": {
"firebase-functions-test": "^3.4.0"
Expand Down
3 changes: 0 additions & 3 deletions Node-1st-gen/testlab-to-slack/functions/pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 0 additions & 3 deletions Node-1st-gen/username-password-auth/functions/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,6 @@ admin.initializeApp({
databaseURL: `https://${process.env.GCLOUD_PROJECT}.firebaseio.com`,
});

const fetch = require('node-fetch');


/**
* Authenticate the provided credentials returning a Firebase custom auth token.
* `username` and `password` values are expected in the body of the request.
Expand Down
3 changes: 1 addition & 2 deletions Node-1st-gen/username-password-auth/functions/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@
"cors": "^2.8.5",
"eslint-plugin-promise": "^7.2.1",
"firebase-admin": "^13.0.2",
"firebase-functions": "^6.3.0",
"node-fetch": "^2.6.7"
"firebase-functions": "^6.3.0"
},
"devDependencies": {
"eslint": "^8.57.1"
Expand Down
3 changes: 0 additions & 3 deletions Node-1st-gen/username-password-auth/functions/pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 3 additions & 5 deletions Node/alerts-to-discord/functions/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,6 @@ const {
const logger = require("firebase-functions/logger");
// [END v2import]

const fetch = require("node-fetch");

/**
* Posts a message to Discord with Discord's Webhook API
*
Expand Down Expand Up @@ -89,7 +87,7 @@ id: \`${id}\`
event.data.payload,
);
} else {
throw new Error(response.error);
throw new Error(`Discord returned status code ${response.status}`);
}
// [END v2SendToDiscord]
} catch (error) {
Expand Down Expand Up @@ -131,7 +129,7 @@ UDID **${testerDeviceIdentifier}** for ${testerDeviceModelName}
`Posted iOS device registration alert for ${testerEmail} to Discord`,
);
} else {
throw new Error(response.error);
throw new Error(`Discord returned status code ${response.status}`);
}
// [END v2SendNewTesterIosDeviceToDiscord]
} catch (error) {
Expand Down Expand Up @@ -192,7 +190,7 @@ exports.postperformancealerttodiscord = onThresholdAlertPublished(
event.data.payload,
);
} else {
throw new Error(response.error);
throw new Error(`Discord returned status code ${response.status}`);
}
// [END v2SendPerformanceAlertToDiscord]
} catch (error) {
Expand Down
3 changes: 1 addition & 2 deletions Node/alerts-to-discord/functions/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,7 @@
"main": "index.js",
"dependencies": {
"firebase-admin": "^13.0.2",
"firebase-functions": "^6.3.0",
"node-fetch": "^2.6.7"
"firebase-functions": "^6.3.0"
},
"devDependencies": {
"@types/node": "^17.0.45",
Expand Down
3 changes: 0 additions & 3 deletions Node/alerts-to-discord/functions/pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion Node/app-distribution-feedback-to-jira/functions/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ import {
onInAppFeedbackPublished} from "firebase-functions/alerts/appDistribution";
import {defineInt, defineSecret, defineString} from "firebase-functions/params";
import logger from "firebase-functions/logger";
import fetch from "node-fetch";
import {FormData} from "formdata-polyfill/esm.min.js";

// The keys are either defined in .env or they are created
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,7 @@
"type": "module",
"dependencies": {
"firebase-functions": "^6.3.0",
"formdata-polyfill": "^4.0.10",
"node-fetch": "^3.3.0"
"formdata-polyfill": "^4.0.10"
},
"devDependencies": {
"eslint": "^8.57.1",
Expand Down
19 changes: 0 additions & 19 deletions Node/app-distribution-feedback-to-jira/functions/pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion Node/remote-config-diff/functions/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ const logger = require("firebase-functions/logger");
// The Firebase Admin SDK to obtain access tokens.
const admin = require("firebase-admin");
const app = admin.initializeApp();
const fetch = require("node-fetch");
const jsonDiff = require("json-diff");
// [END import]

Expand Down
3 changes: 1 addition & 2 deletions Node/remote-config-diff/functions/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,7 @@
"dependencies": {
"firebase-admin": "^13.0.2",
"firebase-functions": "^6.3.0",
"json-diff": "^0.5.5",
"node-fetch": "^2.6.7"
"json-diff": "^0.5.5"
},
"devDependencies": {
"eslint": "^8.57.1",
Expand Down
3 changes: 0 additions & 3 deletions Node/remote-config-diff/functions/pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 3 additions & 7 deletions Node/taskqueues-backup-images/functions/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ const {logger} = require("firebase-functions");

// Dependencies for image backup.
const path = require("path");
const fetch = require("node-fetch");
const {initializeApp} = require("firebase-admin/app");
const {getStorage} = require("firebase-admin/storage");
const {GoogleAuth} = require("google-auth-library");
Expand Down Expand Up @@ -85,16 +84,13 @@ exports.backupapod = onTaskDispatched(
logger.info(`Fetched ${picUrl} from NASA API for date ${date}.`);

const picResp = await fetch(picUrl);
const imageBuffer = await picResp.arrayBuffer();
const buffer = Buffer.from(imageBuffer);
const dest = getStorage()
.bucket(BACKUP_BUCKET)
.file(`apod/${date}${path.extname(picUrl)}`);
try {
await new Promise((resolve, reject) => {
const stream = dest.createWriteStream();
picResp.body.pipe(stream);
picResp.body.on("end", resolve);
stream.on("error", reject);
});
await dest.save(buffer);
} catch (err) {
logger.error(`Failed to upload ${picUrl} to ${dest.name}`, err);
throw new HttpsError("internal", "Uh-oh. Something broke.");
Expand Down
3 changes: 1 addition & 2 deletions Node/taskqueues-backup-images/functions/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,7 @@
"dependencies": {
"firebase-admin": "^13.0.2",
"firebase-functions": "^6.3.0",
"google-auth-library": "^8.6.0",
"node-fetch": "^2.6.7"
"google-auth-library": "^8.6.0"
},
"devDependencies": {
"eslint": "^8.57.1",
Expand Down
Loading