OCI Functions: how to to Invoke Function on Custom VCN with Private Endpoint
I'm collaborating on a project where I've spent hours debugging this and I'm working with issues when attempting to invoke an OCI Function that is deployed in a custom Virtual Cloud Network (VCN) with a private endpoint... The function works perfectly when accessed publicly, but when I try to call it from another service within the same VCN, I receive a `401 Unauthorized` behavior. I've checked the IAM policies and ensured that the calling service has permission to invoke the function. Hereβs the code Iβm using to invoke the function using the OCI Python SDK: ```python import oci # Set up configuration and function client config = oci.config.from_file() function_client = oci.functions.FunctionsControlPlaneClient(config) # Function invocation details function_id = 'your_function_id' payload = {'key': 'value'} try: response = function_client.invoke_function(function_id, body=payload) print(response.data) except oci.exceptions.ServiceError as e: print(f'behavior: {e}') # This is where I get the 401 behavior ``` I've verified that the function's endpoint is set to private in the console and that the correct subnet has been configured for my function's VCN. Additionally, Iβve ensured that the security list allows traffic for the necessary ports. I also tried using Postman to invoke the function but encountered the same `401 Unauthorized` response. I checked the function policies and they seem correct; for example: ```text Allow service functions to invoke functions in compartment <your_compartment> ``` Is there anything I might be missing regarding the network configuration or function policy? Any insights would be greatly appreciated! I recently upgraded to Python LTS. Could this be a known issue?