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]: [AMP] JS Error: The API call is missing an app ID #351

Open
1 task done
chandrapatel opened this issue Feb 14, 2025 · 2 comments
Open
1 task done

[Bug]: [AMP] JS Error: The API call is missing an app ID #351

chandrapatel opened this issue Feb 14, 2025 · 2 comments

Comments

@chandrapatel
Copy link

What happened?

I am trying to setup OneSignal Web Push notification for AMP site using official AMP plugin. It seems like AMP support #276 not added to v3 version so I have referred that PR and AMP Web Push Setup to integrate web push to AMP site. But I'm getting The API call is missing an app ID JS error in browser console.

OneSignalApiBase.js:27 
 Uncaught (in promise) ve: The API call is missing an app ID.
    at Se.call (https://cdn.onesignal.com/sdks/web/v16/OneSignalSDK.sw.js:1:54111)
    at Se.get (https://cdn.onesignal.com/sdks/web/v16/OneSignalSDK.sw.js:1:53824)
    at https://cdn.onesignal.com/sdks/web/v16/OneSignalSDK.sw.js:1:59606
    at Generator.next (<anonymous>)
    at https://cdn.onesignal.com/sdks/web/v16/OneSignalSDK.sw.js:1:7895
    at new Promise (<anonymous>)
    at e (https://cdn.onesignal.com/sdks/web/v16/OneSignalSDK.sw.js:1:7640)
    at downloadServerAppConfig (https://cdn.onesignal.com/sdks/web/v16/OneSignalSDK.sw.js:1:59537)
    at At.<anonymous> (https://cdn.onesignal.com/sdks/web/v16/OneSignalSDK.sw.js:1:122394)
    at Generator.next (<anonymous>)

I have tried to debug, and the following is my finding. I'm not sure if these findings are accurate.

https://cdn.onesignal.com/sdks/web/v16/OneSignalSDK.sw.js

When I try to subscribe, Se.get('sync/${t}/web', null) code execute and requestHasAppId() function called to check if request has App ID but that function look for URL start with apps/ to get App ID but executed URL is start with sync/ so The API call is missing an app ID error happening.

static requestHasAppId(e, t) {
	if (e.startsWith("apps/")) {
		return oe(e.split("/")[1])
	}
	return !(!t || "string" != typeof t.app_id) && oe(t.app_id)
}

Wordpress version

6.7.1

OneSignal Plugin version

3.1.0

Steps to reproduce?

1. Integrate OneSignal Web Push to AMP by following #276 PR or [AMP Web Push Setup](https://documentation.onesignal.com/docs/amp-web-push-setup) documentation.
2. Try to subscribe and you can see JS error in browser console.

What did you expect to happen?

I expected to subscribe to web push notification on AMP site.

Relevant log output

Code of Conduct

  • I agree to follow this project's Code of Conduct
@chandrapatel chandrapatel changed the title [Bug]: AMP - The API call is missing an app ID JS error [Bug]: [AMP] JS Error: The API call is missing an app ID Feb 14, 2025
@sherwinski
Copy link
Contributor

Hi @chandrapatel and thank you for reporting this. I've made a note about this issue and someone from our team will look into it.

@sherwinski
Copy link
Contributor

Hi @chandrapatel, we just published a new version of the web SDK that should address this issue. Please try again and see if the same error persists. Thank you!

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