#NodeJS Google Cloud w/Actions: Container starts and runs locally but not on Google Cloud

1 messages · Page 1 of 1 (latest)

raven yoke
#

I'm following this tutorial: https://docs.dagger.io/sdk/nodejs/620941/github-google-cloud.

I am stuck on step 4, "Test the Dagger pipeline on the local host." Specifically, when I run the pipeline, it mostly succeeds, but the container fails to start. Here are the relevant snippets from the Google Cloud logs for the service. The key message looks to be: "terminated: Application failed to start: Failed to create init process: failed to load /usr/local/bin/npm: exec format error"

First entry
{ "textPayload": "terminated: Application failed to start: Failed to create init process: failed to load /usr/local/bin/npm: exec format error", "insertId": "63dc19fd000a3c3617f7f338", "resource": { "type": "cloud_run_revision", "labels": { "location": "us-central1", "revision_name": "myapp-r8j9r", "configuration_name": "myapp", "service_name": "myapp", "project_id": "composed-yen-376522" } }, "timestamp": "2023-02-02T20:15:57.670705616Z", "severity": "ERROR", "labels": { "instanceId": "00f8b6bdb80126a1cbf50b452348e6ccad34f3a2728beb22ae9b5ef462f963ed8c4ae7bd80445f1ef99002dc74f240cdd992c56690e1b77bf9bbba82c0e760670dcc" }, "logName": "projects/composed-yen-376522/logs/run.googleapis.com%2Fvarlog%2Fsystem", "receiveTimestamp": "2023-02-02T20:15:57.676761598Z" }

Next entry
{ insertId: "63dc19fd000ad1607bfdb89b" labels: {1} logName: "projects/composed-yen-376522/logs/run.googleapis.com%2Fvarlog%2Fsystem" receiveTimestamp: "2023-02-02T20:15:58.010689368Z" resource: {2} severity: "WARNING" textPayload: "Application exec likely failed" timestamp: "2023-02-02T20:15:57.708903099Z" }

Third message
Ready condition status changed to False for Revision myapp-r8j9r with message: The user-provided container failed to start and listen on the port defined provided by the PORT=3000 environment variable. Logs for this revision might contain more information.

#

I found this Stack Overflow thread, and I think this could be the issue since I am using a Mac with an M1 chip. https://stackoverflow.com/questions/66127933/cloud-run-failed-to-start-and-then-listen-on-the-port-defined-by-the-port-envi

chrome barn
#

@raven yoke yes, that's very likely since mac will try to build the container for aarch64 by default

#

Otherwise, try adding .container({ platform: "amd64" }) to this line referenced in the image.

That will tell Dagger to build the image for amd64 which is supported by google cloud. cc @hallow sleet we should clarify this in the guide

raven yoke
#

Thanks! I had to add linux as a prefix to get it to work for that example. I looked at the GraphQL reference to see the options.

// get Node image const node = daggerClient.container({ platform: "linux/amd64" }).from("node:16")

#

This could also be an opportunity to update the NodeJS SDK reference to detail how to tell Dagger to build with a specific architecture.

#

@chrome barn , thank you for your help! On to implementing Actions for the pipeline.