Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Invalid Request. Violations: Event triggered 1st Gen function should have trigger resource set. #425

Closed
huy-trinh-pionero opened this issue Aug 2, 2024 · 7 comments
Labels
bug Something isn't working

Comments

@huy-trinh-pionero
Copy link

huy-trinh-pionero commented Aug 2, 2024

TL;DR

I try to deploy cloud function (gen1, because gen2 does not support trigger firebase auth) but It always response an error

Error: google-github-actions/deploy-cloud-functions failed with: failed to POST https://cloudfunctions.googleapis.com/v2/projects/pds-system-dev/locations/us-central1/functions?functionId=createUserHook: (400) {
  "error": {
    "code": 400,
    "message": "Invalid Request. Violations: Event triggered 1st Gen function should have trigger resource set.",
    "status": "INVALID_ARGUMENT"
  }
}

I don't know what resource is mentioned here, and how to push it in .yaml file

Expected behavior

No response

Observed behavior

No response

Action YAML

name: CI/CD Pipeline

on:
  push:
    branches:
      - main
env:
  AWS_REGION: ap-northeast-1

jobs:
  deploy:
    name: Deploy Function
    runs-on: ubuntu-latest
    environment: dev

    steps:
      - name: Checkout
        uses: actions/checkout@v4
      
      - name: (Dev) Authenticate the action
        id: 'auth'
        uses: 'google-github-actions/auth@v2'
        with:
          credentials_json: ${{ secrets.SERVICE_ACCOUNT_JSON_ONELINE }}

      - name: (Dev) Deploy firebase function
        id: 'deploy'
        uses: 'google-github-actions/deploy-cloud-functions@v3'
        timeout-minutes: 10
        with:
          name: 'createUserHook'
          runtime: 'nodejs20'
          environment: GEN_1
          memory: '128M'
          source_dir: './functions'
          event_trigger_type: 'providers/firebase.auth/eventTypes/user.create'

Log output

No response

Additional information

No response

@huy-trinh-pionero huy-trinh-pionero added the bug Something isn't working label Aug 2, 2024
@huy-trinh-pionero
Copy link
Author

When I add
event_trigger_service_account: '[email protected]' to .yaml file, new error appear:

"error": {
    "code": 400,
    "message": "Invalid Request. Violations: v2.event_trigger.service_account_email shouldn't be set for 1st Gen functions.",
    "status": "INVALID_ARGUMENT"
  }

@sethvargo
Copy link
Member

Hi there - could you please provide the debug output for the complete GitHub Actions workflow run?

@huy-trinh-pionero
Copy link
Author

@sethvargo I have enabled debug logging by set ACTIONS_STEP_DEBUG to true, and below is full output

##[debug]Evaluating: success()
##[debug]Evaluating success:
##[debug]=> true
##[debug]Result: true
##[debug]Starting: (Dev) Deploy firebase function
##[debug]Loading inputs
##[debug]Loading env
Run google-github-actions/deploy-cloud-functions@v3
  with:
    name: createUserHook
    runtime: nodejs20
    environment: GEN_1
    memory: 128M
    source_dir: ./functions
    event_trigger_type: providers/firebase.auth/eventTypes/user.create
    event_trigger_service_account: [email protected]
    region: us-central1
    universe: googleapis.com
    all_traffic_on_latest_revision: true
    ingress_settings: ALLOW_ALL
    service_timeout: 60s
    vpc_connector_egress_settings: PRIVATE_RANGES_ONLY
    event_trigger_retry: true
  env:
    AWS_REGION: ap-northeast-1
    CLOUDSDK_AUTH_CREDENTIAL_FILE_OVERRIDE: /home/runner/work/pds-be/pds-be/gha-creds-7ab1b0f9b43963de.json
    GOOGLE_APPLICATION_CREDENTIALS: /home/runner/work/pds-be/pds-be/gha-creds-7ab1b0f9b43963de.json
    GOOGLE_GHA_CREDS_PATH: /home/runner/work/pds-be/pds-be/gha-creds-7ab1b0f9b43963de.json
    CLOUDSDK_CORE_PROJECT: pds-system-dev
    CLOUDSDK_PROJECT: pds-system-dev
    GCLOUD_PROJECT: pds-system-dev
    GCP_PROJECT: pds-system-dev
    GOOGLE_CLOUD_PROJECT: pds-system-dev
##[debug][F] (420) .eslintrc.js => /home/runner/work/pds-be/pds-be/functions/.eslintrc.js
##[debug][F] (420) .gitignore => /home/runner/work/pds-be/pds-be/functions/.gitignore
##[debug][F] (420) package-lock.json => /home/runner/work/pds-be/pds-be/functions/package-lock.json
##[debug][F] (420) package.json => /home/runner/work/pds-be/pds-be/functions/package.json
##[debug][D] (493) src/ => /home/runner/work/pds-be/pds-be/functions/src/
##[debug][F] (420) src/index.ts => /home/runner/work/pds-be/pds-be/functions/src/index.ts
##[debug][F] (420) tsconfig.dev.json => /home/runner/work/pds-be/pds-be/functions/tsconfig.dev.json
##[debug][F] (420) tsconfig.json => /home/runner/work/pds-be/pds-be/functions/tsconfig.json
Created zip file from './functions' at '/tmp/cfsrc-6b4b18d191565b885595e76a.zip'
Updating existing Cloud Functions deployment
Error: google-github-actions/deploy-cloud-functions failed with: failed to PATCH https://cloudfunctions.googleapis.com/v2/projects/pds-system-dev/locations/us-central1/functions/createUserHook: (400) {
  "error": {
    "code": 400,
    "message": "Invalid Request. Violations: v2.event_trigger.service_account_email shouldn't be set for 1st Gen functions.",
    "status": "INVALID_ARGUMENT"
  }
}
##[debug]Node Action run completed with exit code 1
##[debug]Finishing: (Dev) Deploy firebase function

@sethvargo
Copy link
Member

And what happens if you don't set event_trigger_service_account?

@huy-trinh-pionero
Copy link
Author

huy-trinh-pionero commented Aug 3, 2024

And what happens if you don't set event_trigger_service_account?

the error described my first comment will appear

@sethvargo
Copy link
Member

Sorry, I mean the debug logs for when event_trigger_service_account is not set.

@sethvargo
Copy link
Member

Hi @huy-trinh-pionero - can you please attach the debug logs for when event_trigger_service_account is not set?

@sethvargo sethvargo closed this as not planned Won't fix, can't repro, duplicate, stale Nov 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Development

No branches or pull requests

2 participants