pulumi / pulumi-gcp

A Google Cloud Platform (GCP) Pulumi resource package, providing multi-language access to GCP
Apache License 2.0
183 stars 53 forks source link

StandardAppVersion app engine application errors out with no way to debug #2391

Open pgege opened 2 months ago

pgege commented 2 months ago

Describe what happened

I have been trying to use Pulumi to deploy a standard app engine application for some time now and I feel like I'm spinning my wheels. It always produces an error and after checking my logs on google cloud, I see nothing. Am I missing something?

Sample program

// 1. Create a Google Cloud Storage bucket to store the app code
const storageBucket = new gcp.storage.Bucket("storage-bucket", {
    name: `${project}-${stack}-storage-bucket`, // Bucket name must be globally unique
    location: region,
    forceDestroy: true,
});

const publicAccess = new gcp.storage.BucketIAMMember("public-access", {
    bucket: storageBucket.name,
    role: "roles/storage.objectViewer",
    member: "allUsers",
});

// 2. Package your application code
const appArchive = new pulumi.asset.FileArchive(appDir);

// 3. Upload the application code to the bucket
const appObject = new gcp.storage.BucketObject("app-object", {
    name: "app.zip",
    bucket: storageBucket.name,
    source: appArchive,
});

// 4. Reserve a static IP address (for outbound traffic)
const staticIp = new gcp.compute.Address("static-ip", {
    name: `${project}-${stack}-static-ip`,
    region: region,
});

// 5. Create a VPC Network
const network = new gcp.compute.Network("vpc-network", {
    name: `${project}-${stack}-network`,
    autoCreateSubnetworks: false,
});

// 6. Create a Subnetwork
const subnetwork = new gcp.compute.Subnetwork("vpc-subnetwork", {
    name: `${project}-${stack}-subnetwork`,
    ipCidrRange: "10.0.0.0/28",
    region: region,
    network: network.id,
});

// 7. Create a Serverless VPC Access Connector
const vpcConnector = new gcp.vpcaccess.Connector("vpc-connector", {
    name: `vpc-connect`,
    region: region,
    network: network.name,
    ipCidrRange: "10.8.0.0/28",
});

// 8. Create a Cloud NAT to allow outbound traffic with the static IP
const router = new gcp.compute.Router("vpc-router", {
    name: `${project}-${stack}-router`,
    region: region,
    network: network.id,
});

const nat = new gcp.compute.RouterNat("vpc-nat", {
    name: `${project}-${stack}-nat`,
    router: router.name,
    region: region,
    natIpAllocateOption: "MANUAL_ONLY",
    natIps: [staticIp.id],
    sourceSubnetworkIpRangesToNat: "ALL_SUBNETWORKS_ALL_IP_RANGES",
});

// 9. Deploy the App Engine application
const appEngineApp = new gcp.appengine.Application("app-engine-app", {
    locationId: region,
}, { protect: true });

const appEngineVersion = new gcp.appengine.StandardAppVersion("app-engine-version", {
    versionId: "v1",
    service: "default",
    runtime: "nodejs20", // Set your runtime
    entrypoint: {
        shell: "npm run start",
    },
    deployment: {
        zip: {
            sourceUrl: pulumi.interpolate`https://storage.googleapis.com/${storageBucket.name}/${appObject.name}`,
        },
    },
    envVariables: {
        NODE_ENV: "production",
        PORT: "8080"
    },
    vpcAccessConnector: {
        name: vpcConnector.id,
        egressSetting: "ALL_TRAFFIC",
    },
    deleteServiceOnDestroy: true,
    serviceAccount: "deploy-service-account@project-id.iam.gserviceaccount.com"
}, { dependsOn: [appEngineApp, vpcConnector] });

Log output

sdk-v2/provider2.go:457: sdk.helper_schema: Error waiting to create StandardAppVersion: Error waiting for Creating StandardAppVersion: Error code 13, message: An internal error occurred.: provider=google-beta@8.1.0

Affected Resource(s)

StandardAppVersion

Output of pulumi about

CLI          
Version      3.133.0
Go Version   go1.23.1
Go Compiler  gc

Plugins
KIND      NAME    VERSION
resource  gcp     8.1.0
language  nodejs  unknown

Host     
OS       darwin
Version  14.6.1
Arch     arm64

Additional context

No response

Contributing

Vote on this issue by adding a 👍 reaction. To contribute a fix for this issue, leave a comment (and link to your pull request, if you've opened one already).

iwahbe commented 2 months ago

Hi @pgege. I'm sorry your having issues here.

Have you checked out the google-cloud channel in our community slack?

Otherwise, could you post the entire error message.

pgege commented 2 months ago

I will try that channel, the log output I shared is the extent of the error message I get. Makes it challenging to understand what's going on.

guineveresaenger commented 2 months ago

I sent these over Slack as well but perhaps the following links are helpful:

https://cloud.google.com/appengine/docs/flexible/troubleshooting#disable_guest_attributes https://stackoverflow.com/questions/76902475/error-code-13-message-an-internal-error-occurred-when-deploying-to-app-engine