Skip to main content

When I am setting attributes with Cordova whether generically like this:

Purchases.setAttributes({“age”: “24”});

Or when using something like the display name like this:

Purchases.setDisplayName(“Doe”);

I always end up with an error message that looks like this:

To Native Cordova ->  PurchasesPlugin setAttributes INVALID u"options": {
    age = 24;
}]]

Or this for the display name:

To Native Cordova ->  PurchasesPlugin setDisplayName INVALID p"options": ADoe]]

 

Am I missing something? I went through and updated everything in my app to be uptodate. I am using the following versions of things:

"@ionic-native/core": "^5.35.0",
"@ionic-native/purchases": "^5.35.0",
"cordova-plugin-purchases": "^2.3.0",

Everything else with purchases is working just fine as far as I can tell, I just can’t seem to use it to set an attribute.

Hi @Asher!

That error is actually not something that RevenueCat throws, it looks like it’s coming from the system. Just to confirm, are you calling the setAttributes(...) and setDisplayName(...) after calling setup


Yes this is the current order I run things:

Purchases.setDebugLogsEnabled(true);

Purchases.setup("publicKey", 'UserID');

Purchases.setAttributes({“age”: “24”});

All of this runs in  function onDeviceReady()


Oops I accidentally clicked best answer and it doesn’t seem like there is a way to undo that. :sweat:


Hey @Asher!

No worries, I just removed the best answer. I will forward your request into our ticketing system to collect some additional information and will post back here once we figure out what’s going on. 


So I just checked and JavaScript/Typescript doesn’t like the kind of quotes you used in the array {“age”: “24”});

This could of course be to styling on the RevenueCat webpage but the Public Key in the line above has the correct double quotes. Worth a shot!


Hello, @Asher Did you solve the issue you faced?

I am getting the same error like you in my ionic capacitor project.

PurchasesPlugin setAttributes INVALID "options": {

    "$displayName" = test;

    "$email" = "test@gmail.com";

    "$firebaseAppInstanceId" = K3Qnk3yQQ7qGeIAENofl;

    adultType = "";

    childType = "";

}]]

but that worked sometimes, I am not sure what I am missing.

I want to solve this issue.

Thanks.


Reply