Skip to content

ALREADY_EXISTS error while trying to update function with dash instead of underscore in name #447

Open
@vitorelourenco

Description

@vitorelourenco

TL;DR

The error seems to be realated to how gcp treats function names. The correct function name was foo_bar but in the name field for the action, I had written foo-bar instead.

Expected behavior

An error message saying 'Failed to update' or a successful update.

Observed behavior

Error showing an attempt to create a cloud function with the "same name".

Action YAML

name: ...
on:
  push:
    branches:
      - main
    paths:
      - ...
  workflow_dispatch:
jobs:
  deploy-job:
    environment: ...

    permissions:
      id-token: write
      contents: read

    runs-on: ubuntu-latest

    steps:
      - name: Checkout repo
        uses: actions/checkout@v4

      - id: 'auth'
        name: 'Authenticate to Google Cloud'
        uses: 'google-github-actions/auth@v2'
        with:
          workload_identity_provider: ...
          service_account: ...

      - id: 'deploy'
        uses: 'google-github-actions/deploy-cloud-functions@v3'
        with:
          name: ...
          runtime: 'nodejs20'
          entry_point: ...
          environment: 'GEN_2'
          region: ...
          source_dir: ...

      - name: Report Status
        if: always()
        uses: ravsamhq/notify-slack-action@v2
        with:
          status: ${{ job.status }}
          notify_when: 'failure'
        env:
          ...

Log output

Run google-github-actions/deploy-cloud-functions@v3
Created zip file from --REDACTED--
Creating new Cloud Functions deployment
Error: google-github-actions/deploy-cloud-functions failed with: failed to POST --REDACTED--: (409) {
  "error": {
    "code": 409,
    "message": "Could not create Cloud Run service --REDACTED--. A Cloud Run service with this name already exists. Please redeploy the function with a different name.",
    "status": "ALREADY_EXISTS"
  }
}

Additional information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions