Skip to content

[ServiceWorler fix] - Failed to get a ServiceWorkerRegistration error.#49

Merged
monorkin merged 2 commits intobasecamp:mainfrom
milos-dukic:service-worker-error-fix
Sep 15, 2025
Merged

[ServiceWorler fix] - Failed to get a ServiceWorkerRegistration error.#49
monorkin merged 2 commits intobasecamp:mainfrom
milos-dukic:service-worker-error-fix

Conversation

@milos-dukic
Copy link
Copy Markdown
Contributor

When starting Campfire locally, following error occurs, visible in browser console:
Uncaught (in promise) SecurityError: Failed to get a ServiceWorkerRegistration: The origin of the provided documentURL ('null') does not match the current origin ('http://localhost:3000')

Seems that the issue is mismatch of arguments in getRegistration() call.
The argument should be origin (protocol + host), but window.location.host is passed, which is only host without protocol.

Comment thread app/javascript/controllers/notifications_controller.js Outdated
Co-authored-by: Chris Oliver <excid3@gmail.com>
@monorkin
Copy link
Copy Markdown
Contributor

@milos-dukic looks great, thank you for the fix

@monorkin monorkin merged commit 2d1c6e3 into basecamp:main Sep 15, 2025
7 checks passed
Peyochanchan referenced this pull request in Peyochanchan/once-campfire Apr 13, 2026
Fix "Failed to get a ServiceWorkerRegistration" error
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

Successfully merging this pull request may close these issues.

3 participants