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

could not initialize New Relic client #42

Open
juupas opened this issue May 9, 2023 · 3 comments
Open

could not initialize New Relic client #42

juupas opened this issue May 9, 2023 · 3 comments
Labels
good first issue Good for newcomers

Comments

@juupas
Copy link

juupas commented May 9, 2023

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/[email protected]
      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
Copy link
Contributor

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?

@NSSPKrishna NSSPKrishna added the waiting-response Waiting for the response from the reporter label May 15, 2023
@wrobbins
Copy link

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: <REDACTED>
# 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/[email protected] 
        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.

  • Pin deployment-marker-action to a versioned FROM image of the NR CLI instead of using latest. This will avoid any breaking (or unknown) changes happening in the CLI that might break this Action. Fortunately this wasn't the case. I.E. FROM newrelic/cli:latest --> FROM newrelic/cli:v0.68
  • Better error messaging than what is given from the CLI. Possibly solutions:
    • Work with the CLI team to have a better error message than what we currently get about profile not being configured. A profile isn't actually necessary for the CLI to work. The actual error is that NEW_RELIC_API_KEY is unset/blank.
    • If working with the CLI team isn't an option update entrypoint.sh to do the precondition check- making sure NEW_RELIC_API_KEY is set and has a value.

@sanderblue
Copy link
Contributor

Agreed we should have better error messaging :)

@NSSPKrishna NSSPKrishna added good first issue Good for newcomers and removed waiting-response Waiting for the response from the reporter labels Oct 11, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

4 participants