0x80 / mono-ts

A quest for the perfect TS monorepo setup
MIT License
76 stars 7 forks source link

Attempting to deploy using this example seems to not work? #11

Closed michaelnguyenm closed 3 months ago

michaelnguyenm commented 3 months ago

Hello! Thank you for the work on isolate-package and this sample repository, as it has been great for developing a monorepo for Firebase, particularly when I was using the emulators. However, I've tried deploying just the API service for this example repository using npx firebase deploy --project some-project-name and it appears to not deploy on my end. So I tried using npx firebase deploy --debug to see if I could get some more info and it seems to just point me elsewhere as shown in the snippet below:

[2024-04-01T05:33:38.805Z] Failed docker command with error  HTTP Error: 404, Not Found {"name":"FirebaseError","children":[],"context":{"body":{"errors":[{"code":"NAME_UNKNOWN","message":"Repository \"eu.gcr.io\" not found"}],"error":{"message":"Not Found"}},"response":{"statusCode":404}},"exit":1,"message":"HTTP Error: 404, Not Found","status":404}
!  functions: Unhandled error cleaning up build images. This could result in a small monthly bill if not corrected. You can attempt to delete these images by redeploying or you can delete them manually at https://console.cloud.google.com/gcr/images/some-project-id/eu/gcf
[2024-04-01T05:33:38.806Z] Functions deploy failed.
[2024-04-01T05:33:38.806Z] {
  "endpoint": {
    "id": "api",
    "project": "some-project-id",
    "region": "europe-west3",
    "entryPoint": "api",
    "platform": "gcfv2",
    "runtime": "nodejs20",
    "httpsTrigger": {},
    "labels": {
      "deployment-tool": "cli-firebase"
    },
    "secretEnvironmentVariables": [
      {
        "key": "DEMO_API_KEY",
        "secret": "DEMO_API_KEY",
        "projectId": "some-project-id",
        "version": "1"
      }
    ],
    "ingressSettings": null,
    "availableMemoryMb": null,
    "serviceAccount": null,
    "timeoutSeconds": null,
    "maxInstances": null,
    "minInstances": null,
    "concurrency": 80,
    "vpc": null,
    "environmentVariables": {
      "FIRESTORE_EMULATOR_HOST": "localhost:8080",
      "FIREBASE_CONFIG": "{\"projectId\":\"some-project-id\",\"storageBucket\":\"some-project-id.appspot.com\"}",
      "GCLOUD_PROJECT": "some-project-id",
      "EVENTARC_CLOUD_EVENT_SOURCE": "projects/some-project-id/locations/europe-west3/services/api"
    },
    "codebase": "api",
    "cpu": 1,
    "targetedByOnly": false,
    "hash": "2df6a17a2879b46efc425a28a009b953deb5eb1e"
  },
  "op": "create",
  "original": {
    "name": "FirebaseError",
    "children": [],
    "exit": 1,
    "message": "Could not create or update Cloud Run service api, Container Healthcheck failed. Revision 'api-00001-roj' 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.\n\nLogs URL: https://console.cloud.google.com/logs/viewer?project=some-project-id&resource=cloud_run_revision/service_name/api/revision_name/api-00001-roj&advancedFilter=resource.type%3D%22cloud_run_revision%22%0Aresource.labels.service_name%3D%22api%22%0Aresource.labels.revision_name%3D%22api-00001-roj%22 \nFor more troubleshooting guidance, see https://cloud.google.com/run/docs/troubleshooting#container-failed-to-start",
    "status": 3,
    "code": 3
  }
}
[2024-04-01T05:33:38.807Z] Error: Failed to create function api in region europe-west3
    at C:\Users\mega\github\mono-ts\node_modules\.pnpm\firebase-tools-with-isolate@13.6.2\node_modules\firebase-tools-with-isolate\lib\deploy\functions\release\fabricator.js:303:27
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async Fabricator.createV2Function (C:\Users\mega\github\mono-ts\node_modules\.pnpm\firebase-tools-with-isolate@13.6.2\node_modules\firebase-tools-with-isolate\lib\deploy\functions\release\fabricator.js:284:30)
    at async Fabricator.createEndpoint (C:\Users\mega\githubmono-ts\node_modules\.pnpm\firebase-tools-with-isolate@13.6.2\node_modules\firebase-tools-with-isolate\lib\deploy\functions\release\fabricator.js:136:13)
    at async handle (C:\Users\mega\github\mono-ts\node_modules\.pnpm\firebase-tools-with-isolate@13.6.2\node_modules\firebase-tools-with-isolate\lib\deploy\functions\release\fabricator.js:88:17)

Error: There was an error deploying functions

So it seems that it's possible to see some logs in the logs explorer for the sample project I made for this on Firebase/GCP:

image

I'm a bit puzzled as to why this error is occurring as I figured that these imports would be figured out by following along with this solution? I'm wondering if there is anything I'm missing or any insights you might have?

0x80 commented 3 months ago

Thanks for reporting. I can reproduce the problem on my end. I upgraded some dependencies yesterday, and it seems something there is causing the issue.

If you roll back two commits to "Fix remeda import" it seems to work again. I'll look into it later.

0x80 commented 3 months ago

This has been fixed now