agisboye / app-store-server-api

A Node.js client for the App Store Server API
MIT License
210 stars 32 forks source link

As soon as i add the await decodeNotificationPayload(signedPayload) call in to my code, firebase functions wont deploy #28

Closed jhonatan-3a closed 1 year ago

jhonatan-3a commented 1 year ago

its giving me the error Error: Functions codebase could not be analyzed successfully. It may have a syntax or runtime error as soon as i add this function to my codebase, any reasons why?

agisboye commented 1 year ago

This sounds like an issue with Firebase functions. Can you specify which version of Node.js to use? Note that version 15.6.0 or later is required.

jhonatan-3a commented 1 year ago

your probably right, im using v16, tried using 18 buts also failing

nicoladaniello commented 1 year ago

I'm having the same issue.

Mac M1 firebase-cli: 12.4.6 node: 19.2.0

Test function:

import { decodeNotificationPayload } from "app-store-server-api";
import { onRequest } from "firebase-functions/v2/https";

export const helloWorld = onRequest({ cors: [/apple\.com$/] }, async (req, res) => {
  const payload = await decodeNotificationPayload(req.body);

  res.send(payload.data.appAppleId);
});

Error log:

Could not create or update Cloud Run service helloworld, Container Healthcheck failed. Revision 'helloworld-00007-kov' is not ready and cannot serve traffic. The user-provided container failed to start and listen on the port defined provided by the PORT=8080 environment variable. Logs for this revision might contain more information.

Logs URL: https://console.cloud.google.com/logs/viewer?project=lettera-ac811&resource=cloud_run_revision/service_name/helloworld/revision_name/helloworld-00007-kov&advancedFilter=resource.type%3D%22cloud_run_revision%22%0Aresource.labels.service_name%3D%22helloworld%22%0Aresource.labels.revision_name%3D%22helloworld-00007-kov%22 
For more troubleshooting guidance, see https://cloud.google.com/run/docs/troubleshooting#container-failed-to-start

@jhonatan-3a did you also report it to firebase?

— Edit

@jhonatan-3a I’ve just noticed that your error is different from mine.

I had the same issue as you and was due to a wrong import.

Check your import is correct:

import { decodeNotificationPayload } from “app-store-server-api”

jhonatan-3a commented 1 year ago

hey, @nicoladaniello i have that line comented out for now, will check after lunch and tell you asap what i got