import {onRequest} from "firebase-functions/v2/https";
import * as logger from "firebase-functions/logger";
import { PKPass } from "passkit-generator";
export const helloWorld = onRequest(async (request, response) => {
logger.info("Hello logs!");
try {
const pass = await PKPass.from({
model: "./passModels/myFirstModel.pass",
certificates: {
wwdr: "./src/controllers/ios/certs/wwdr.pem",
signerCert: "./src/controllers/ios/certs/signerCert.pem",
signerKey: "./src/controllers/ios/certs/signerKey.pem",
signerKeyPassphrase: "Ticketclub",
},
}, {
// keys to be added or overridden
serialNumber: "AAGH44625236dddaffbda"
});
logger.info("buffer", pass);
// Adding some settings to be written inside pass.json
pass.localize("en", {});
pass.setBarcodes("36478105430"); // Random value
const buffer = pass.getAsBuffer();
logger.info("aaa", buffer);
//doSomethingWithTheBuffer(buffer);
} catch (err) {
//doSomethingWithTheError(err);
}
response.send("Hello from Firebase!");
});
[REQUIRED] Steps to reproduce
initialize firebase.
language is typescript.
copy and paste the code above.
run firebase deploy --only functions
[REQUIRED] Expected behavior
Deploy functions.
[REQUIRED] Actual behavior
Log:
i deploying functions
Running command: npm --prefix "$RESOURCE_DIR" run build
> build
> tsc
✔ functions: Finished running predeploy script.
i functions: preparing codebase default for deployment
i functions: ensuring required API cloudfunctions.googleapis.com is enabled...
i functions: ensuring required API cloudbuild.googleapis.com is enabled...
i artifactregistry: ensuring required API artifactregistry.googleapis.com is enabled...
✔ functions: required API cloudfunctions.googleapis.com is enabled
✔ functions: required API cloudbuild.googleapis.com is enabled
✔ artifactregistry: required API artifactregistry.googleapis.com is enabled
i functions: Loading and analyzing source code for codebase default to determine what to deploy
Serving at port 8062
shutdown requested via /__/quitquitquit
i functions: preparing functions directory for uploading...
i functions: packaged /Users/tenna/Desktop/wallet_osuka/firebase/functions (36.96 MB) for uploading
i functions: ensuring required API run.googleapis.com is enabled...
i functions: ensuring required API eventarc.googleapis.com is enabled...
i functions: ensuring required API pubsub.googleapis.com is enabled...
i functions: ensuring required API storage.googleapis.com is enabled...
✔ functions: required API storage.googleapis.com is enabled
✔ functions: required API run.googleapis.com is enabled
✔ functions: required API eventarc.googleapis.com is enabled
✔ functions: required API pubsub.googleapis.com is enabled
i functions: generating the service identity for pubsub.googleapis.com...
i functions: generating the service identity for eventarc.googleapis.com...
✔ functions: functions folder uploaded successfully
i functions: updating Node.js 18 (2nd Gen) function helloWorld(us-central1)...
Build failed with status: FAILURE and message: yarn run v1.22.19
error Command "plugin" not found.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.. For more details see the logs at https://console.cloud.google.com/cloud-build/builds;region=us-central1/fffe36cb-b5ab-4053-b743-734711189432?project=1082101732317.
Functions deploy had errors with the following functions:
helloWorld(us-central1)
i functions: cleaning up build files...
Error: There was an error deploying functions
Having trouble? Try again or contact support with contents of firebase-debug.log
Were you able to successfully deploy your functions?
[REQUIRED] Version info
node:
v18.0.0
firebase-functions:
firebase-tools:
12.5.3
firebase-admin:
[REQUIRED] Test case
Code:
[REQUIRED] Steps to reproduce
initialize firebase. language is typescript. copy and paste the code above. run firebase deploy --only functions
[REQUIRED] Expected behavior
Deploy functions.
[REQUIRED] Actual behavior
Log:
Were you able to successfully deploy your functions?
No