OCI Function Deployment Error

OCI Function Deployment Error
Photo by Scott Rodgerson / Unsplash

Oracle Cloud Infrastructure offers serverless functions based on the open-source Fn framework. It's a container-native serverless platform that can be run anywhere. For OCI, function development requires a set of tools working together to create and deploy functions in accord. Often, this set of independent tools means you receive some mysterious error without a clear explanation or the root cause.

For example, the screenshot below demonstrates function deployment failure.

Mysterious error message during the deployment

Even the verbose output does not help you to get to the bottom of the issue, but authorization failure suggests two possible options:

  • Docker has invalid credentials and fails to authenticate against OCI Container Registry
  • Docker has valid credentials but uses them against the wrong registry.

In my specific case, the second option was the problem. To solve it, let Fn SDK know where your target registry is. The fix is easy, and according to your preferences, you may specify the registry URL through the environment variable.

$ export FN_REGISTRY=<region-key>.ocir.io/<tenancy-namespace>/my-project

An alternative and more permanent way is to update your Fn project context and add a registry URI to the SDK configuration.

$ fn update context registry <region-key>.ocir.io/my-project

The OCI Container registry URI requires some decryption

region-key The three-letter code for the OCI global regions.
If you are on the East Coast, most likely it would be iad.
tenancy-namespace The unique tenancy attribute that
you may find on the OCI Tenancy page
as an "Object storage namespace."
my-project The repository prefix is used to
organize images in the registry.
I normally use the application name.

The mystery error is gone, and function deployment has been completed.