newrelic / deployment-marker-action

Github Action for recording a Deployment Marker in New Relic
https://github.com/marketplace/actions/new-relic-application-deployment-marker
Apache License 2.0
61 stars 24 forks source link

could not initialize New Relic client #42

Open juupas opened 1 year ago

juupas commented 1 year ago

We are getting the following when trying to create a marker for our app in GitHub Actions:

level=fatal msg="could not initialize New Relic client, make sure your profile is configured with newrelic profile configure"

This is the step configuration we have:

    - name: Create New Relic OTEL Application Deployment Marker
      if: ${{ steps.guid_otel.outputs.guid != '' }}
      uses: newrelic/deployment-marker-action@v2.3.0
      with:
        apiKey: ${{ secrets.api_key }}
        region: "EU"
        guid: ${{ steps.guid_otel.outputs.guid }}
        version: ${{ steps.version.outputs.version }}
        deeplink: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
        user: "${{ github.actor }}"

We've had markers working some time before, so I don't know what has happened.

sanderblue commented 1 year ago

Hi @juupas, thanks for reporting. So far I haven't been able to reproduce the issue. That error message typically means credentials are missing. Can you double check your API key is set in your GitHub secrets?

wrobbins commented 1 year ago

My team encountered this as well. The issue was that secrets aren't passed through to "reusable workflows" GH docs.

Working example ``` jobs: ... notify: uses: ./.github/workflows/deploy-notifications.yml secrets: new_relic_api_key: ${{ secrets.NEW_RELIC_API_KEY }} with: new_relic_deployment_entity_guid: ``` ``` # deploy-notifications.yml name: Notify of the most recent deployment on: workflow_call: secrets: new_relic_api_key: required: true description: "The New Relic API key." inputs: new_relic_deployment_entity_guid: required: true type: string jobs: newrelic: runs-on: ubuntu-latest name: New Relic Deployment Marker steps: - name: Set Release Version from Tag run: echo "RELEASE_VERSION=${{ github.ref_name }}" >> $GITHUB_ENV - name: New Relic Application Deployment Marker uses: newrelic/deployment-marker-action@v2.4.0 with: region: "US" apiKey: ${{ secrets.new_relic_api_key }} guid: ${{ inputs.new_relic_deployment_entity_guid }} version: "${{ env.RELEASE_VERSION }}" user: "${{ github.actor }}" ```

From what we went through debugging this image locally - I have a few recommendations for the NR team.

sanderblue commented 1 year ago

Agreed we should have better error messaging :)