You are developing a serverless applicationwith Oracle Functions. You have created a function in compartment

By | December 2, 2022

You are developing a serverless applicationwith Oracle Functions. You have created a function in compartment named prod. When you try to invoke your function you get the following error.
Errorinvokingfunction.status:502message:dhcp options ocid1.dhcpoptions.oc1.phx.aaaaaaaac…doesnot existorOracleFunctionsisnotauthorized touseit How can you resolve this error?

Correct Answer: C
Explanation
Troubleshooting Oracle Functions:
There are common issues related to Oracle Functions and how you can address them.
Invoking a function returns a FunctionInvokeSubnetNotAvailable message and a 502 error (dueto a DHCP Options issue) When you invoke a function that you’ve deployed to Oracle Functions, you might see the following error message:
{“code”:”FunctionInvokeSubnetNotAvailable”,”message”:”dhcp options ocid1.dhcpoptions…….. does not exist or OracleFunctions is not authorized to use it”} Fn: Error invoking function. status: 502 message: dhcp options ocid1.dhcpoptions…….. does not exist or Oracle Functions is not authorized to use it If you see this error:
Double-check that a policy has been created to give Oracle Functions access to network resources.
Create Policies to Control Access to Network and Function-Related Resources:
Service Access to Network Resources
When Oracle Functions users create a function or application, they have to specify a VCN and a subnet in which to create them. To enable the Oracle Functions service to create the function or application in the specified VCN and subnet, you must create an identity policy to grant the Oracle Functions service access to the compartment to which the network resources belong.
To create a policy to give the Oracle Functions service access to network resources:
Log in to the Console as a tenancy administrator.
Create a new policy in the root compartment:
Open the navigation menu. Under Governanceand Administration, go to Identity and click Policies.
Follow the instructions in To create a policy, and give the policy a name (for example, functions-service-network-access).
Specify a policy statement to give the Oracle Functions service access to the network resources in the compartment:
Allow service FaaS to use virtual-network-family in compartment <compartment-name> For example:
Allow service FaaS to use virtual-network-family in compartment acme-network Click Create.
Double-check that the set of DHCP Options in the VCN specified for the application still exists.
References:
https://docs.cloud.oracle.com/en-us/iaas/Content/Functions/Tasks/functionstroubleshooting.htm
https://docs.cloud.oracle.com/en-us/iaas/Content/Functions/Tasks/functionscreatingpolicies.htm