Firebase:无法在“ IDBDatabase”上执行“事务”。的JavaScript

时间:2019-03-19 11:46:59

标签: javascript firebase push-notification

使用Firebase Push通知时遇到问题。它确实询问了通知权限,但是当我单击允许时,它会输出已授予权限的消息并返回该错误

Unable to get permission to notify. DOMException: Failed to execute 'transaction' on 'IDBDatabase': One of the specified object stores was not found.
    at https://www.gstatic.com/firebasejs/4.6.2/firebase.js:27:6914
    at new Promise (<anonymous>)
    at https://www.gstatic.com/firebasejs/4.6.2/firebase.js:27:6880

代码

 const messaging = firebase.messaging();
  messaging
    .requestPermission()
    .then(function () {
      MsgElem.innerHTML = "Notification permission granted."
      console.log("Notification permission granted.");

      // get the token in the form of promise
      return messaging.getToken()
    })
    .then(function (token) {
      TokenElem.innerHTML = "token is : " + token
    })
    .catch(function (err) {
      ErrElem.innerHTML = ErrElem.innerHTML + "; " + err
      console.log("Unable to get permission to notify.", err);
    });

有什么想法吗?

0 个答案:

没有答案