Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/reactjs/26.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 无法在HTTPS上注册默认服务工作程序_Javascript_Reactjs_Firebase_Amazon S3_Firebase Cloud Messaging - Fatal编程技术网

Javascript 无法在HTTPS上注册默认服务工作程序

Javascript 无法在HTTPS上注册默认服务工作程序,javascript,reactjs,firebase,amazon-s3,firebase-cloud-messaging,Javascript,Reactjs,Firebase,Amazon S3,Firebase Cloud Messaging,我正在react web app中处理推送通知,它在本地主机http上运行良好,但当我通过AWS在生产过程中部署它时,它运行在https上,给了我403的错误。 以下是错误: 获取脚本时收到错误的HTTP响应代码(403)。 检索令牌时出错。FirebaseError:消息传递:我们无法注册 默认服务工作者。未能为作用域注册ServiceWorker ('https://test-admin.xyz.com/firebase-cloud-messaging-push-scope') 用脚本('h

我正在react web app中处理推送通知,它在本地主机http上运行良好,但当我通过AWS在生产过程中部署它时,它运行在https上,给了我403的错误。 以下是错误:

获取脚本时收到错误的HTTP响应代码(403)。

检索令牌时出错。FirebaseError:消息传递:我们无法注册 默认服务工作者。未能为作用域注册ServiceWorker ('https://test-admin.xyz.com/firebase-cloud-messaging-push-scope') 用脚本('https://test-admin.xyz.com/firebase-messaging-sw.js):A 获取脚本时收到错误的HTTP响应代码(403)。 (消息传递/服务工作人员注册失败)。 在e。(https://test-admin.xyz.com/assets/js/main.29ef2af8959eb43577ee.bundle.js?29ef2af8959eb43577ee:878:1873) 在https://test-admin.xyz.com/assets/js/main.29ef2af8959eb43577ee.bundle.js?29ef2af8959eb43577ee:700:2383 掷物(https://test-admin.xyz.com/assets/js/main.29ef2af8959eb43577ee.bundle.js?29ef2af8959eb43577ee:700:2488) 在s(https://test-admin.xyz.com/assets/js/main.29ef2af8959eb43577ee.bundle.js?29ef2af8959eb43577ee:700:1277)

以下是firebase消息传递服务工作人员文件:

//firebase和firebase消息传递脚本 进口文件('https://www.gstatic.com/firebasejs/8.2.0/firebase-app.js'); 进口文件('https://www.gstatic.com/firebasejs/8.2.0/firebase-messaging.js');

//通过传递 生成的配置

var firebaseConfig={apiKey: “AIzaSyDwRQ7TnwcQMHBGVFfjke_kL7adO9UwU”,
authDomain: “testing-1234.firebaseapp.com”,
projectId:‘测试-1234’, storageBucket:'testing-1234.appspot.com',
messagingSenderId: “55426181234”,
appId:'1:554261888019:web:db350912348762f0e513e6', 测量结果:'G-X412VFPLD',}

firebase.initializeApp(firebaseConfig)

//检索firebase messaging const messaging=firebase.messaging()

messageing.onBackgroundMessage(功能(有效负载){
log('接收到的后台消息451',有效负载); //setItem('checknow','uzair');const notificationTitle=

payload.notification.title

通知选项={ body:payload.notification.body,}

self.registration.showNotification(通知标题, 通知选项); });

以下是文件夹结构: