Legacy Dev Forum Posts

 View Only

Sign Up

Scope of NodeJS App regarding instances of the Client (please check the UPD comment)

  • 1.  Scope of NodeJS App regarding instances of the Client (please check the UPD comment)

    Posted 06-05-2025 18:19

    RomanSmoll | 2021-05-04 14:42:49 UTC | #1

    Hey.

    I was testing stuff on my dev side ( which is mypurecloud.ie) and I used the following in NodeJS:

    const platformClientCore = require('purecloud-platform-client-v2'); const purecloudClient = platformClientCore.ApiClient.instance; purecloudClient.setEnvironment(platformClientCore.PureCloudRegionHosts.euwest1)

    And everything worked just fine.

    Now I need to run it for the client and his server is at DE (hence EU-Central-1)

    I've tried many options from forums incuding the string version but Even if I try the following (for example)

    purecloudClient.setEnvironment(platformClientCore.PureCloudRegionHosts.eucentral1);

    I still get 400 and at the expanded version of the error I still (somehow) see the

    host: 'login.mypurecloud.ie'

    How can this be possible and is there a proper workaround ?

    P.s : i took the enum from here : https://github.com/MyPureCloud/platform-client-sdk-dotnet/blob/master/build/src/PureCloudPlatform.Client.V2/Client/PureCloudRegionHosts.cs


    RomanSmoll | 2021-05-04 14:43:05 UTC | #2

    UPD:

    Ok , 5 minutes later I came up with a solution:

    So long story short the instance of the purecloud have been used in 2 different files.

    • If they both had the same region, it worked for all of the cases
    • If they had different regions, it worked for one out of 2

    Do I assume correctly that the problem is not with PC itself rather than with my SCOPE of NodeJS application ?

    Because this code also works with npm requireNew library.


    system | 2021-06-04 14:40:36 UTC | #3

    This topic was automatically closed 31 days after the last reply. New replies are no longer allowed.


    This post was migrated from the old Developer Forum.

    ref: 10811