becem-gharbi / nuxt-fcm Goto Github PK
View Code? Open in Web Editor NEWFirebase Cloud Messaging for Nuxt
License: MIT License
Firebase Cloud Messaging for Nuxt
License: MIT License
I am using :
@bg-dev/nuxt-fcm": "^0.2.5"
"nuxt": "^3.5.1",
And keep on getting the error in the title:
If I inspect further it seems that my $fcm is not registration, I have followed the steps as per docs, not sure what I am missing and hope someone can assist:
import { useNuxtApp } from "/_nuxt/node_modules/nuxt/dist/app/index.js?v=beecf9d0";
import { getToken as _getToken } from "/_nuxt/node_modules/firebase/messaging/dist/esm/index.esm.js?v=beecf9d0";
import { onMessage as _onMessage } from "/_nuxt/node_modules/firebase/messaging/dist/esm/index.esm.js?v=beecf9d0";
export default function() {
const { $fcm } = useNuxtApp();
async function getToken() {
return _getToken($fcm.messaging).catch(() => "");
}
function onMessage(cb) {
_onMessage($fcm.messaging, cb);
}
return { getToken, onMessage };
}
Hi... I have a problem that when we add this module, our firebase data is exposed in client / browser source code. As I know that nuxt 3 expose the runtime config public data in the client side without separating the file or encrypt or anything that makes the data more secure. Which is the fcm data in this module I think has been moved to the runtimeConfig public when nuxt app running.
Can you give me an advice for that ?
Thanks.
I really don't want to commit files into our git repo with configuration details in them, is there any way the SW JS file can use environment variables or have the configuration passed into it?
Thanks
Hello Cant subscribe to topic {
"url": "/api/fcm/topic/subscribe",
"statusCode": 401,
"statusMessage": "",
"message": "unauthorized",
"stack": "
<span class="stack internal">at handleError (D:\V2\node_modules\@bg-dev\nuxt-fcm\dist\runtime\server\utils\error.mjs:7:19)\n<span class="stack internal">at Object.handler (D:\V2\node_modules\@bg-dev\nuxt-fcm\dist\runtime\server\api\fcm\topic\subscribe.post.mjs:18:5)\n<span class="stack internal">at Object.handler (/D:/V2/node_modules/h3/dist/index.mjs:2196:34)\n<span class="stack internal">at /D:/V2/node_modules/h3/dist/index.mjs:1962:31\n<span class="stack internal">at async Object.callAsync (/D:/V2/node_modules/unctx/dist/index.mjs:72:16)\n<span class="stack internal">at async Server.toNodeHandle (/D:/V2/node_modules/h3/dist/index.mjs:2249:7)"
Hi! I've got this strange issue, related with my firebaseConfig:
defineNuxtConfig: {
....
ssr: true,
fcm: {
firebaseConfig: {
apiKey: "XXXXXXXXXXX"",
authDomain: "XXXXXXXXXXX"",
databaseURL: "XXXXXXXXXXX"",
projectId: "XXXXXXXXXXX"",
storageBucket: "XXXXXXXXXXX"",
messagingSenderId: "XXXXXXXXXXX",
appId: "XXXXXXXXXXX",
measurementId: "XXXXXXXXXXX"",
},
vapidKey: "XXXXXXXXXXX",
},
.....
}
But I ain't got this issue week before,
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.