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 (in promise) TypeError: Cannot read properties of undefined (reading 'message') #1106

Open
ndarproj opened this issue Sep 21, 2023 · 5 comments

Comments

@ndarproj
Copy link

ndarproj commented Sep 21, 2023

What happened?

I am using the latest version of laravel which is Laravel v10.24.0 (PHP v8.1.10) and i am getting an error

i have this code on head

    <script src="https://cdn.onesignal.com/sdks/web/v16/OneSignalSDK.page.js" defer></script>
    <script>
        window.OneSignalDeferred = window.OneSignalDeferred || [];
        OneSignalDeferred.push(function(OneSignal) {
            OneSignal.init({
                appId: "d7c7e6bb-81a3-4d18-90b8-e99ffb3d3b4f",
            });
        });
    </script>

onesignal2
onesignal

What browsers are you seeing the problem on?

Firefox, Chrome (Chromium), Brave

What operating system are you running?

Windows 10

Steps to reproduce?

1. Setup Web Platform w/ localhost:8000 as site url
2. Run Laravel php artisan serve
3. Go to localhost:8000

What did you expect to happen?

The notification bell button would appear on my lower left corner

Relevant log output

No response

@jkasten2
Copy link
Member

@ndarproj Thanks for reporting. The error isn't clear here but this due to the v16 SDK no longer supporting sites that are HTTP or use the os.tc domain. This change is part of the v16 release notes release notes. You will need configure OneSignal to use your own HTTPS domain on the dashboard to switch to the OneSignal v16 SDK.

We will be making an update to the OneSignal SDK to provide a better error to make this requirement more clear.

@CropWatchDevelopment
Copy link

My website is HTTPS hosted on Vercel and I am getting this same exact error as well.

@softwareonair
Copy link

I'm trying to debug my app on the localhost. since v16 requires https domain, how should we work on the localhost?

i have followed the local testing instructions on documentation btw

@jkasten2
Copy link
Member

jkasten2 commented Sep 29, 2023

@softwareonair You can enable the "LOCAL TESTING" when you use a url that start with http://localhost.
image

Note that http is limited to localhost as a secure context is required for service workers which is required for push. If you need to test a different URL it must start with https://

@jesobreira
Copy link

jesobreira commented Oct 10, 2023

I was facing this issue on a domain that uses HTTPS (in production)...

It seems we must disable the os.tc feature in the app config and rename OneSignalSDK.sw.js to OneSignalSDKWorker.js.

It seems that the docs are too outdated or misleading...

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

5 participants