oracle/oci-typescript-sdk

oci-sdk conflicts with @here/olp-sdk-authentication

Closed this issue · 4 comments

I am not sure in which package the issue is, but when @here/olp-sdk-authentication is imported before oci package, all requests to Oracle Cloud return 404 Not Found error.

Request cannot be retried. Not Retrying. Exception occurred : Error: Not Found

Example:

const olpSdkAuthentication = require("@here/olp-sdk-authentication");
const { ConfigFileAuthenticationDetailsProvider } = require("oci-common");
const { StreamClient, models } = require("oci-streaming");

(async () => {
    const provider = new ConfigFileAuthenticationDetailsProvider();

    const client = new StreamClient({ authenticationDetailsProvider: provider });

    client.endpoint = '<endpoint>';
    const streamId = '<stream-id>';

    const response = await client.createGroupCursor({
        createGroupCursorDetails: {
            groupName: 'default',
            type: models.CreateGroupCursorDetails.Type.TrimHorizon,
            commitOnGet: true,
            },
        streamId: streamId
    });

    console.log("response.cursor.value", response.cursor.value);
})();

Node version: v10.24.1
npm version: 6.14.12

The issue is not happening if @here/olp-sdk-authentication is imported after the oci sdk.

cc @OleksiiZubko, to investigate, maybe the problem is on heremaps sdk side.

@greg-md - Importing @here/olp-sdk-authentication does indeed lead to the above issue. We are looking into it and will keep you updated when we have a fix.

It seems like this occurs due to presence of conflicting http request libraries. OCI SDK uses isomorphic-fetch while @here/olp-sdk-authentication uses @here/olp-sdk-fetch while using the same namespace.

Currently, there is incompatibility between @here/olp-sdk-authentication and @here/olp-sdk-fetch because of the way the OCI SDK http library isomorphic-fetch uses/modifies the global fetch. Please use the workaround of changing the order of imports.

Hi @greg-md ,

I will be closing this issue for now based on the workaround and Yash's response. Please feel free to reopen this if needed.

Thanks.