According to MDN spec https://developer.mozilla.org/en-US/docs/Web/API/Notification/requestPermission_static the possible return values are granted, denied, or default. Your code, despite the MDN example at https://developer.mozilla.org/en-US/docs/Web/API/ServiceWorkerRegistration/showNotification and others, must act accordingly. (Note this is the SERVICE WORKER version) I suggest and "if not denied" approach. You can also just do the actions regardless of permission and there will be no error.