sw


Action: file_editor create /app/vercel-deploy/firebase-messaging-sw.js --file-text "/* BaithKee News - Firebase Cloud Messaging Service Worker
 * यह फाइल Vercel root पर \"firebase-messaging-sw.js\" नाम से ही होनी चाहिए।
 * जब browser बंद हो या tab background में हो तब notifications यही file दिखाती है।
 */

importScripts(\"https://www.gstatic.com/firebasejs/10.8.1/firebase-app-compat.js\");
importScripts(\"https://www.gstatic.com/firebasejs/10.8.1/firebase-messaging-compat.js\");

firebase.initializeApp({
    apiKey: \"AIzaSyAwpf0IEd0wl6mvJ6EV5XB3XQYoLwmWXZQ\",
    authDomain: \"baithkee-news.firebaseapp.com\",
    projectId: \"baithkee-news\",
    storageBucket: \"baithkee-news.firebasestorage.app\",
    messagingSenderId: \"1051043299858\",
    appId: \"1:1051043299858:web:1b2c6b4aac4aaca4254ecb\"
});

const messaging = firebase.messaging();

// Background message handler
messaging.onBackgroundMessage((payload) => {
    const title = (payload.notification && payload.notification.title) || (payload.data && payload.data.title) || \"BaithKee News\";
    const body = (payload.notification && payload.notification.body) || (payload.data && payload.data.body) || \"\";
    const newsId = (payload.data && payload.data.newsId) || \"\";

    const options = {
        body: body,
        icon: \"https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgxZYThJov7nVLeejJp30nZ130Js5tuIKOicgFSzAT8BV-sWAhDWy2oWKX5uzTY9BpRefSvN-leUHeaIvcTPDYCX7G2qjChtibiJapDQ1IzCTVekLffx7d-jZopQRENCRh-12BzEHwC4azCmX1mcavCBGCfa8Yf3Rhv0XxucZ6IwppXX1m_flG5YV1X8ig/s1600/20260412_015639_0000.png\",
        badge: \"https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgxZYThJov7nVLeejJp30nZ130Js5tuIKOicgFSzAT8BV-sWAhDWy2oWKX5uzTY9BpRefSvN-leUHeaIvcTPDYCX7G2qjChtibiJapDQ1IzCTVekLffx7d-jZopQRENCRh-12BzEHwC4azCmX1mcavCBGCfa8Yf3Rhv0XxucZ6IwppXX1m_flG5YV1X8ig/s1600/20260412_015639_0000.png\",
        image: (payload.data && payload.data.image) || undefined,
        tag: newsId || \"baithkee-news\",
        data: { newsId: newsId, click_url: (payload.data && payload.data.click_url) || \"/\" },
        requireInteraction: false
    };

    self.registration.showNotification(title, options);
});

// Notification click handler - opens app and goes to that news
self.addEventListener(\"notificationclick\", (event) => {
    event.notification.close();
    const newsId = (event.notification.data && event.notification.data.newsId) || \"\";
    const targetUrl = newsId ? (\"/?news=\" + newsId) : \"/\";

    event.waitUntil(
        clients.matchAll({ type: \"window\", includeUncontrolled: true }).then((clientList) => {
            for (const client of clientList) {
                if (\"focus\" in client) {
                    client.navigate(targetUrl);
                    return client.focus();
                }
            }
            if (clients.openWindow) return clients.openWindow(targetUrl);
        })
    );
});
"
Observation: Create successful: /app/vercel-deploy/firebase-messaging-sw.js

Fetching debug logs for expo

==> /var/log/supervisor/expo.err.log <==
Check the Ngrok status page for outages: https://status.ngrok.com/
error Command failed with exit code 1.
CommandError: TypeError: Cannot read properties of undefined (reading 'body')
Check the Ngrok status page for outages: https://status.ngrok.com/
error Command failed with exit code 1.
CommandError: TypeError: Cannot read properties of undefined (reading 'body')
Check the Ngrok status page for outages: https://status.ngrok.com/
error Command failed with exit code 1.
CommandError: TypeError: Cannot read properties of undefined (reading 'body')
Check the Ngrok status page for outages: https://status.ngrok.com/
error Command failed with exit code 1.
CommandError: TypeError: Cannot read properties of undefined (reading 'body')
Check the Ngrok status page for outages: https://status.ngrok.com/
error Command failed with exit code 1.
CommandError: TypeError: Cannot read properties of undefined (reading 'body')
Check the Ngrok status page for outages: https://status.ngrok.com/
error Command failed with exit code 1.
CommandError: TypeError: Cannot read properties of undefined (reading 'body')
Check the Ngrok status page for outages: https://status.ngrok.com/
error Command failed with exit code 1.

==> /var/log/supervisor/expo.out.log <==
$ /app/frontend/node_modules/.bin/expo start --tunnel --port 3000
env: load .env
env: export EXPO_TUNNEL_SUBDOMAIN EXPO_PACKAGER_HOSTNAME EXPO_PUBLIC_BACKEND_URL EXPO_USE_FAST_RESOLVER METRO_CACHE_ROOT EXPO_PACKAGER_PROXY_URL
Starting project at /app/frontend
Fast resolver is enabled.
Metro is running in CI mode, reloads are disabled. Remove CI=true to enable watch mode.
Starting Metro Bundler
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
yarn run v1.22.22
$ /app/frontend/node_modules/.bin/expo start --tunnel --port 3000
env: load .env
env: export EXPO_TUNNEL_SUBDOMAIN EXPO_PACKAGER_HOSTNAME EXPO_PUBLIC_BACKEND_URL EXPO_USE_FAST_RESOLVER METRO_CACHE_ROOT EXPO_PACKAGER_PROXY_URL
Starting project at /app/frontend
Fast resolver is enabled.
Metro is running in CI mode, reloads are disabled. Remove CI=true to enable watch mode.
Starting Metro Bundler
Tunnel connected.
Tunnel ready.
Waiting on http://localhost:3000
Logs for your project will appear below.


Fetching debug logs for backend

==> /var/log/supervisor/backend.err.log <==
INFO:     Will watch for changes in these directories: ['/app/backend']
INFO:     Uvicorn running on http://0.0.0.0:8001 (Press CTRL+C to quit)
INFO:     Started reloader process [171] using WatchFiles
INFO:     Started server process [206]
INFO:     Waiting for application startup.
INFO:     Application startup complete.
INFO:     Shutting down
INFO:     Waiting for application shutdown.
INFO:     Application shutdown complete.
INFO:     Finished server process [206]
INFO:     Stopping reloader process [171]
INFO:     Will watch for changes in these directories: ['/app/backend']
INFO:     Uvicorn running on http://0.0.0.0:8001 (Press CTRL+C to quit)
INFO:     Started reloader process [849] using WatchFiles
INFO:     Started server process [887]
INFO:     Waiting for application startup.
INFO:     Application startup complete.

==> /var/log/supervisor/backend.out.log <==


Fetching debug logs for mongodb

tail: cannot open '/var/log/supervisor/mongodb*.log' for reading: No such file or directory

इस ब्लॉग से लोकप्रिय पोस्ट

The History of the World – A Simple and Long Article for English Learners

High Level Advance Random English Words

1. The Art of Self-Discipline