Skip to content

Fn: provider in position: 1 is nil. ComposingConfigurationProvider does not support nil values #228

Description

@simengineering

fn create context zonea --provider oracle
fn use context zonea
fn update context oracle.compartment-id $COMPID
fn update context api-url $API_URL
fn update context registry $ARTIFACTORY

fn create app image-import --annotation oracle.com/oci/subnetIds='["$SUBNET"]'

returns error : Fn: provider in position: 1 is nil. ComposingConfigurationProvider does not support nil values

fn list contexts

CURRENT NAME PROVIDER API URL REGISTRY
default default http://localhost:8080

Activity

  1. arun-siv commented on Jul 16, 2024

    @arun-siv

    I also get the same error

  2. vini-hap-biofy commented on Aug 1, 2024

    @vini-hap-biofy

    Was experiencing this same error when trying to run the fn deploy command inside a GitHub action.

    Even if using the Run an Oracle Cloud Infrastructure (OCI) CLI" command action before, to confirm I was authenticated, the same error occurred.

    Turns out the Fn CLI tool does not support authentication via the environment variables that the OCI CLI can use (OCI_CLI_USER, OCI_CLI_TENANCY, OCI_CLI_FINGERPRINT, OCI_CLI_KEY_CONTENT, OCI_CLI_REGION). It always tries to look for the OCI configuration files inside the $HOME/.oci/ folder. This is very unfortunate, as those files would never get created in an environment where oci config can't be run, as it is an interactive script.

    The only solution I found for now was creating all these files manually inside the action, running the Fn CLI commands, and then deleting all the files. This needs to be done in the same step, or else sensitive info (such as your OCI private key) will be exposed in the Docker layers.

    Here's an example:

    - name: Run Fn CLI commands
      run: |-
        mkdir "${HOME}/.oci" &&
        echo "${{ secrets.OCI_API_KEY }}" > ${HOME}/.oci/oci_api_key.pem &&
        echo "[DEFAULT]
        user=${{ secrets.OCI_USER }}
        fingerprint=${{ secrets.OCI_API_KEY_FINGERPRINT }}
        key_file=${HOME}/.oci/oci_api_key.pem
        tenancy=${{ secrets.OCI_TENANCY_ID }}
        region=${{ vars.OCI_REGION }}" > "${HOME}/.oci/config" &&
        fn -v deploy --app my-app &&
        rm -rf "${HOME}/.oci/"

    Only by doing this the Fn commands started working correctly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions