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

[Bug]: "Invalid action" message for any action (addTag, addAliases, requestPermission) #941

Closed
eirielson opened this issue Nov 27, 2023 · 1 comment

Comments

@eirielson
Copy link

eirielson commented Nov 27, 2023

What happened?

Hi, I'm migrating from version 3 to the latest release 5. After initialization, the device is successfully registered with OneSignal users, however, no other actions are performed successfully: addTags, listeners, option. All of these throw an "invalid action" exception. This way, tags are not updated in OneSignal, nor are external_ids, listeners to handle when pushes are opened are also not executed.
It seems to me to be a general instability in the library, any method other than "initialize" returns errors, even the methods for setting the Debug Level.

image

The second user registration is using the old API, version 3, which is why the Tag values are set
image

Steps to reproduce?

Lib version: "onesignal-cordova-plugin": "5.0.3"
I created some methods to call manually, to perform the initialize, add tags, listeners functions.
All of these actions below return an invalid action message.

initialize() {
        // This set return a error
        OneSignal.Debug.setLogLevel(6);

        OneSignal.initialize("...");

        let myClickListener = async function (event) {
            let notificationData = JSON.stringify(event);
            console.log(notificationData);
        };

        //invalid action
        OneSignal.Notifications.addEventListener('click', myClickListener);

        //invalid action         
        OneSignal.login("...");       
    }

    addTags() {
        OneSignal.User.addTags({
            key: "value",
            key2: "value",
        });

        OneSignal.User.addAlias('idek', idUserPush);
    }

    permission() {
        OneSignal.Notifications.requestPermission(true).then(s => {
            alert(s);
        });
    }
    optin() {
        OneSignal.User.pushSubscription.optIn();
    }

    optout() {
        let perm = OneSignal.Notifications.hasPermission();
        console.log(perm);
        console.log(OneSignal.User.pushSubscription.optedIn);
        
        OneSignal.User.pushSubscription.optOut();
    }


### What did you expect to happen?

I want to start the session, set a user's tags and external id and control the opening of pushes with their parameters.


### OneSignal Cordova SDK version

5.0.3

### Which platform(s) are affected?

- [ ] iOS
- [X] Android

### Relevant log output

_No response_

### Code of Conduct

- [X] I agree to follow this project's Code of Conduct

<!-- probot = {"onesignal-probot":{"response_time_in_business_days":1}} -->
@eirielson eirielson changed the title [Bug]: [Bug]: "Invalid action" message for any action (addTag, addAliases, requestPermission) Nov 27, 2023
@ehrgeiz2538
Copy link

How did you fix this?

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

No branches or pull requests

2 participants