https://pulumi.com logo
#google-cloud
Title
# google-cloud
c

crooked-cat-6983

12/07/2023, 12:21 PM
Hi guys, @dazzling-salesclerk-51689 and I are trying to migrate from using pulumi GCP functions gen1 to gen2. Pulumi recently released support in the gen2 functions, I'm trying to implement this in my code using typesctipt. I'm getting this error when trying to apply the stack
Copy code
Error waiting to create function: Error waiting for Creating function: Error code 3, message: Create repository operation for projects/.../locations/us-east1/repositories/gcf-artifacts has failed
This is my function creation code:
Copy code
public static createGcpFunction(
    functionName: string,
    sourceBucket: Bucket,
    destBucketName: string,
    orgId: string,
    region: string,
    gcpProvider: Provider
  ): gcp.cloudfunctionsv2.Function {
    const { copyFunction: copyFunctionConfig } = GcpResourcesConfig

    return new gcp.cloudfunctionsv2.Function(
      functionName,
      {
        location: region,
        name: functionName,
        buildConfig: {
          runtime: copyFunctionConfig.runtime,
          entryPoint: copyFunctionConfig.entryPoint,
          source: {
            storageSource: {
              bucket: copyFunctionConfig.sourceCodeBucketName,
              object: copyFunctionConfig.sourceCodeArchiveName,
            },
          },
        },
        eventTrigger: {
          eventType: 'google.cloud.storage.object.v1.finalized',
          triggerRegion: region,
          eventFilters: [
            {
              attribute: 'bucket',
              value: sourceBucket.name,
            },
          ],
        },
        serviceConfig: {
          maxInstanceCount: 1000,
          availableMemory: `${copyFunctionConfig.memoryMb}M`,
          timeoutSeconds: copyFunctionConfig.timeoutSeconds,
          environmentVariables: {
            DEST_BUCKET: destBucketName,
            ORG_ID: orgId,
          },
        },
        labels: GcpResourcesConfig.defaultLabels,
      },
      {
        protect: true,
        provider: gcpProvider,
        dependsOn: [sourceBucket, gcpProvider],
        customTimeouts: DEFAULT_CUSTOM_TIMEOUT,
      }
    )
  }
My gamble is that the issue is with the build section, but I'm not sure what to change there. Any ideas on what could be the issue? Thanks 🙂
d

dry-keyboard-94795

12/07/2023, 1:14 PM
If it's the build section, there should be some logs available in the CloudBuild console
The repository reference suggests there's a problem creating an artifact registry repository. It's worth going to Artifact Registry in the console to make sure it's enabled for your account too
c

crooked-cat-6983

12/10/2023, 9:15 AM
Thanks @dry-keyboard-94795 The logs aren't showing anything special..
Also, artifact registry is enabled. We're still looking into this issue.