Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Invoking function fails when SDK version updated from 3.9.1 to 3.13.0 and 3.14.0 #517

Open
GindiKhangura opened this issue May 18, 2023 · 2 comments
Labels
Functions Issue pertains to the Functions service

Comments

@GindiKhangura
Copy link

Invoking functions worked with SDK v3.9.1; after updating the version to 3.13.0 and 3.14.0, both versions throw the error com.oracle.bmc.model.BmcException: Error returned by InvokeFunction operation in FunctionsInvoke service.(404, NotAuthorizedOrNotFound, false) You're trying to invoke a function without setting the invoke endpoint.

Note: the same endpoint was provided in all cases (example: https://aabbcc112233.us-ashburn-1.functions.oci.oraclecloud.com).

I do not see any related breaking changes documented in the changelog.

@KartikShrikantHegde
Copy link

Hi @GindiKhangura , I doubt this has to do with SDK behavior because typically 404 error means either you don’t have the right permission to access the resource or the resource doesn’t exist. I would suggest checking if your permissions exist or got modified to point to a different resource/compartment etc, OR the resource exists in the correct location where you have the permission defined.

@KartikShrikantHegde KartikShrikantHegde added the Functions Issue pertains to the Functions service label May 31, 2023
@austinddavis
Copy link

Updating this with some new information. I'm one of Gindi's teammates and I picked up the SDK update task and ended up figuring out what was happening. I've also provided a workaround for anyone else running into this issue at the end.

In 3.12.1 the BaseClient constructor was updated so that after the endpoint is set, the region is set which may override the endpoint already provided if a region is provided; In our case we provide the region, and the endpoint to the builder.

To confirm this was our issue I did a sanity check where we passed in the URL we received from the Function service, something similar to https://aabbcc112233.us-ashburn-1.functions.oci.oraclecloud.com, alongside the region, built a new FunctionsInvokeClient, then finally called client.getEndpoint(), the endpoint we provided was not returned, instead we were returned "https://functions.us-ashburn-1.oci.oraclecloud.com". This incorrect endpoint URL being set by the OCI SDK is what was causing our 404 issues.

-- Workaround --

Calling 'client.setEndpoint(String endpoint)` after constructing the client correctly sets the endpoint.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Functions Issue pertains to the Functions service
Projects
None yet
Development

No branches or pull requests

3 participants