Twilio push notifications with firebase error: unsupported MIME type ('text/html')

Twilio push notifications with firebase error: unsupported MIME type ('text/html')

我正在尝试将 firebase 与 twilio 集成以进行推送通知。

首先,我遵循了 this guide on the twillio official site. They using an old version of firebase so I had to change the step 6 using this firebase guide,它说在检索令牌之前在我的域的根目录中添加一个 firebase-messaging-sw.js 文件。但具体在哪里?我试着到处添加它,但它不起作用。

控制台向我显示此错误:

我正在使用 next.js 打字稿。

你对如何解决这个问题有什么建议吗?

next.js static files are served from the public directory. The Firebase docs direct you to add the firebase-messaging-sw.js file to the root of your domain 中,因此您应该将该文件添加到 public 目录中。