Differences between OCI Functions and Fn Project
Find out about the differences between OCI Functions and Fn Project.
In general, OCI Functions and Fn Project are very similar. However there are some differences, as detailed below.
Image-Based Functions and Code-Only Functions
Both Fn Project and OCI Functions support image-based functions. For image-based functions, the function's container image is pulled from a specified container registry. See Creating Image-Based Functions from Existing Docker Images.
Code-only functions are specific to OCI Functions. With code-only functions, you create a function from an archive that contains the function code and dependencies, without building and publishing a container image yourself. OCI Functions uses managed runtimes for code-only functions. See Creating Functions from Archives (Code-only Functions)
Differences in Authentication When Making API Calls
- the OCID of the compartment to which the function belongs
- Oracle Cloud Infrastructure authentication details
Differences When Invoking Functions
To invoke a function deployed to OCI Functions, you have to explicitly specify an Oracle Cloud Infrastructure endpoint (unless you're using the Fn Project CLI).
For example,
https://fht7ns4mn2q.us-phoenix-1.functions.oci.oraclecloud.com/20181201/functions/ocid1.fnfunc.oc1.phx.aaaa____uxoa/actions/invoke.
You can obtain the appropriate endpoint by making a call to the API, either directly or by using the Fn Project CLI command:
fn inspect function <app-name> <function-name>Additional Context Configuration Parameters in OCI Functions
As well as supporting Fn Project context configuration parameters, OCI Functions also has some additional parameters, as shown in the following table.
| Additional Parameter | Set in | Value | Notes |
|---|---|---|---|
provider
|
A context configuration .yaml file in ~/.fn/contexts |
oracle
|
Enables OCI Functions rather than Fn Project functionality. When
See Creating an Fn Project CLI Context to Connect to Oracle Cloud Infrastructure. |
oracle.compartment-id
|
A context configuration .yaml file in ~/.fn/contexts |
<compartment -ocid>
|
Specifies the OCID of the Oracle Cloud Infrastructure compartment that owns function-related resources. See Creating an Fn Project CLI Context to Connect to Oracle Cloud Infrastructure. |
oracle.profile
|
A context configuration .yaml file in ~/.fn/contexts |
<profile-name>
|
Specifies which profile to use from the ~/.oci/config file. If not set, the profile named default is used. See Setting the Context for the Fn Project CLI Using the oracle.profile Parameter |
object_storage_bucket_name |
A context configuration .yaml file in ~/.fn/contexts | <bucket-name> |
Optional for code-only functions. Specifies the Object Storage bucket to use for function archives when the Fn Project CLI implicit developer flow uploads code-only function archives to Object Storage. Use with See Implicitly creating a code-only function using the fn init, fn build, and fn deploy commands. |
object_storage_namespace |
A context configuration .yaml file in ~/.fn/contexts | <object-storage-namespace> |
Optional for code-only functions. Specifies the Object Storage namespace for the bucket to use for function archives when the Fn Project CLI implicit developer flow uploads code-only function archives to Object Storage. Use with See Implicitly creating a code-only function using the fn init, fn build, and fn deploy commands. |
Use of Annotations
When you're creating and viewing OCI Functions resources using the Fn Project CLI, you'll typically use parameters to specify values. For example, when using fn create app <app-name> to create a new application, you'll normally use the --subnet-id <subnet-ocid> parameter to specify the OCID of the subnet in which to run functions.
For advanced use and for backwards compatibility, some Fn Project CLI commands also support the use of annotations to identify and specify associated Oracle Cloud Infrastructure resources.
For example:
- When you're using the Fn Project CLI to create a new application, you can use the
--annotationparameter to specify the OCID of the subnet in which to run the function, in the format:fn create app <app-name> --annotation oracle.com/oci/subnetIds='["<subnet-ocid>"]' - When you're using the Fn Project CLI to view the properties of a function, the
annotationselement shows the OCID of the compartment that owns the function.
Note that unlike other configuration parameters and environment variables, annotation values cannot be passed as arguments to running functions.