alexandercerutti/passkit-generator

Cannot deploy to cloud functions

Closed this issue · 2 comments

Running OS

Mac OS Ventura

Running Node Version

18.0.0

Description

I am trying to deploy functions like this (test code) on cloud functions, but get following error.

Code:


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!",PKPass);
   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("aaaaaa", buffer);
      //doSomethingWithTheBuffer(buffer);
   } catch (err) {
      //doSomethingWithTheError(err);
   }
   response.send("Hello from Firebase!");
});

Error:

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/53d71221-8096-410c-b6e2-5f843a367b67?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

Expected behavior

Deploy to cloud functions

Steps to reproduce

$ firebase init

Add below to tscnofig.json
"esModuleInterop": true, "allowSyntheticDefaultImports": true,

$ yarn add passkit-generator

Copy and paste the code above

$ firebase deploy

Were you able to verify it by using (and changing) the examples?

Yes

Other details

  • I'm available to open a Pull Request to resolve the problem (after the triage)

Thank you for easy to use passkit project!
Starred for you⭐️

Never mind. I fixed it somehow.

Felt like a problem with yarn 🤷‍♂️. Glad you solved