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]: Uncaught TypeError: e is not iterable at o.processOneSignalDeferredArray #1210

Open
Jonathan-Ha opened this issue Nov 19, 2024 · 3 comments

Comments

@Jonathan-Ha
Copy link

Jonathan-Ha commented Nov 19, 2024

Screenshot 2024-11-19 104542
Screenshot 2024-11-19 104614

@Jonathan-Ha Jonathan-Ha changed the title [Bug] Uncaught TypeError: e is not iterable at o.processOneSignalDeferredArray [Bug]: Uncaught TypeError: e is not iterable at o.processOneSignalDeferredArray Nov 19, 2024
@sherwinski
Copy link
Contributor

Hi @Jonathan-Ha,

Could you please share/paste the code snippet of where you have the SDK init code defined?

Reference: https://documentation.onesignal.com/docs/web-sdk-setup#7-add-code-to-site

@vdr-bcg-robinweston
Copy link

vdr-bcg-robinweston commented Dec 13, 2024

We have started seeing this too:

Screenshot 2024-12-13 at 6 16 33 PM

Here's our initialisation code - part of a React component:

useEffect(() => {
    if (typeof window !== undefined) {
      window.OneSignalDeferred = window?.OneSignalDeferred || [];
      window.OneSignalDeferred.push(async function (OneSignal) {
        await OneSignal.init({
          appId: env('NEXT_PUBLIC_ONESIGNAL_APP_ID') || getEnvironmentVariable('ONESIGNAL_APP_ID'),
        });
        OneSignal.User.addTag('user_id', userId);
      });
    }
  }, []);

Here is the script tag

<script src="https://cdn.onesignal.com/sdks/web/v16/OneSignalSDK.page.js" defer></script>

@jihad28
Copy link

jihad28 commented Dec 14, 2024

I have the same issue, here is my code

window.OneSignalDeferred = window.OneSignalDeferred || [];
window.OneSignalDeferred.push(async function (OneSignal) {
    await OneSignal.init({
        appId: import.meta.env.VITE_ONESIGNAL_APP_ID,
        serviceWorkerPath: "service-worker.js",
        promptOptions: {
            slidedown: {
                prompts: [{
                    type: "push",
                    autoPrompt: false,
                    text: {
                        actionMessage: LA.send_notification_text,
                        acceptButton: LA.yes,
                        cancelButton: LA.no
                    }
                }]
            }
        }
    });
});

and the script tag

<script src="https://cdn.onesignal.com/sdks/web/v16/OneSignalSDK.page.js" defer></script>

I don't know why it's like this but sometimes when you reload multiple times or do (Ctrl + F5) the error despairs and when you reload it again it shows up again.

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

4 participants