• Resolved tsuchim

    (@tsuchim)


    Dear PWA for WP team,

    Thank you for creating such a useful plugin.

    I wanted to use it, but I encountered a problem with pwa-register-sw.js.

    A global variable named “messaging” seems to be declared twice in line 3.
    I tried to replace it with :
    if (typeof messaging === “undefined”) { const messaging = firebase.messaging(); }
    and it seemed to work for me.

    I understand that this may not be your fault, but I would appreciate it if you could take this case into account.

    Thank you in advance.

    The page I need help with: [log in to see the link]

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Author Magazine3

    (@magazine3)

    Hi, Sorry for the inconvenience. We will be here to assist you. We will check it and get back to you shortly once we checked it.

    Plugin Author Magazine3

    (@magazine3)

    Hi, Can you please let us know, Is it happening after any particular update? If yes kindly do let us know the version if possible.

    Thread Starter tsuchim

    (@tsuchim)

    Thank you for your response.

    The error message on Chrome is:
    Uncaught SyntaxError: Identifier 'messaging' has already been declared (at pwa-register-sw-1.js?ver=1.7.57:1:1)

    My Software Versions are:
    WordPress 6.1.1
    PWA plugin 1.7.57

    I found another solution. I commented out line 3: const messaging = firebase.messaging; and replaced all ‘messaging’ in pwa-register-sw-1.js with ‘firebase.messaging’.

    I think the pwa-register-sw-1.js is fine on its own, but another plugin is using the global variable ‘messaging’ as ‘const’ in another .js file, and conflicts with the definition in pwa-register-sw-1.js as the error.

    Plugin Author Magazine3

    (@magazine3)

    Hi, Thank you for the information. Can you please check once and let us know which plugin is causing the conflict and let us know back the plugin which is causing the issue. So that we will inspect the issue and assist you accordingly to resolve it.

    Plugin Author Magazine3

    (@magazine3)

    @tsuchim As we haven’t received a response, I’ll mark this as resolved due to inactivity. Feel free to open a new support topic if you continue to encounter issues, or reopen this topic and we’d be happy to assist. Thank you!

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Identifier ‘messaging’ has already been declared’ is closed to new replies.