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

Uncaught TypeError: publicKey is of type object. The type of publicKey must be string #470

Open
maher640 opened this issue Oct 4, 2024 · 0 comments

Comments

@maher640
Copy link

maher640 commented Oct 4, 2024

I’m experiencing an issue with the strict equality operator in the following function, which leads to an Uncaught TypeError in the Production instance. The function works correctly in all other environments, but the problem is isolated to Production. Changing the comparison to == seems to resolve the issue.

    getAccountKeys: function() {
        var keys = {};
        var str = this.getValue(constants.CKO_MODE) === 'live' ? 'Live' : 'Sandbox';
        var liveOrSandboxPreference = (str === 'Live') ? constants.CKO_LIVE_ABC_OR_NAS_ENABLED : constants.CKO_SANDBOX_ABC_OR_NAS_ENABLED;
        var abcOrNasEnabled = this.getValue(liveOrSandboxPreference);

        keys.publicKey = this.getValue('cko' + str + abcOrNasEnabled + 'PublicKey');
        keys.secretKey = this.getValue('cko' + str + abcOrNasEnabled + 'SecretKey');
        keys.privateSharedKey = this.getValue('cko' + str + abcOrNasEnabled + 'PrivateSharedKey');

        return keys;
    }

Another point:
abcOrNasEnabled is of type EnumValue, therefore a better use of it would be abcOrNasEnabled.value.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

1 participant