Firebase web push notification Service worker issue - firebase

I am new to web push notification area. I want to send firebase web notifications from web to web. I tried doing that and ended up with this error
FirebaseError: Messaging: We are unable to register the default service worker. Failed to register a ServiceWorker: A bad HTTP response code (404) was received when fetching the script. (messaging/failed-serviceworker-registration)
I dont know where am I went wrong. Thanks in Advance

You need to add the service worker file firebase-messaging-sw.js to the location where your files are served. This is the service worker firebase looks for.
Also, you need to share code with examples of what you are doing. No one is going to write your code from scratch.

Finally got the answer.
We need to copy firebase-messaging-sw.js file and save it in the root of the folder.
Since I used xampp, I ve push my push folder inside htdocs folder (/xampp/htdocs/push/), but you need to make sure that the firebase-messaging-sw.js should be in the root of the localhost(/xampp/htdocs/). i.e, when you search localhost/firebase-messaging-sw.js in browser, you shouldn't get a 404 error.

Related

Publishing Flutter Web App to Firebase Hosting: recent changes not published

My Codemagic pipeline is configured to fetch sources from my repository, build web and publish it to Firebase hosting.
The build is each time successful, but the changes from my last commit are not there, so I assume that the publishing part somehow not woking properly.
In the logs though everything looks great, my last commit is fetched, and firebase logs say that deploy is complete with the link to the site and all. (see below)
How could I "Debug" this case, any ideas on what is wrong?
you can try following steps to debug such type of issues:
open site in incognito mode to ensure issue not related to browser cache
check Cache-Control and Date response headers for main.dart.js file to ensure you have properly configured cache behaviour in Firebase Hosting
https://firebase.google.com/docs/hosting/manage-cache
https://firebase.google.com/docs/hosting/full-config#headers
I hope it will help

error publishing application could not access deployment

OMG
Just as i go to deploy an app, i start getting this message :
Error publishing application: could not access deployment (File may have been deleted in drive or you may no longer have permission to access it).
screenshot
So i am the admin of my gsuite account and the owner of the file. tried turning off and on the appmaker in the admin page of gsuite.
Just before i got this message i deleted a bunch of defunct scripts from my drive. could this be related? could it be related to the projects in the cloud platform?
i have 'deployed' the app using the [PUBLISH] button which works fine!
thanks for anyone who can help
i didnt find out the cause of the issue but this problem can be worked around by exporting the app to zip, creating a new app and importing the zip file...
just answering this here incase someone gets stuck with the above message.

Service worker fetch event is never fired

I am developing Progressive Web Apps with Laravel. I have referred PWA with Laravel for developing. In that first I generated service worker, then updated laravel mix after that set manifest file. In the layout I checked for service worker and push notification support. After registering service worker, install and activate are successfully triggered but fetch event is never triggered even when the browser set to offline as in the image browser offline. Also referred this video PWA LARAVEL. Code for package.json file is as shown in the image: package.json code for webpack.config.js file is: webpack.config.js, section of code in the blade(view) for registering service worker is:service-worker registration. Service worker is generated in public folder of my laravel project. I am new to Laravel and PWA. Thank you.
I got the answer. Actually in my laravel project I had removed public from url. But service worker will receive fetch events for everything on its domain; that is if we register the service worker file at /example/sw.js, then the service worker would only see fetch events for pages whose URL starts with /example/ (i.e. /example/page1/, /example/page2/). So I should change my url pattern to public. Thank you.

Mail sending error from the IIS and Shared Server in asp.net

Im doing a project where i have to send a link to my user/clients. The mail will be sent to them once they register their account. Now there will be a link in their mail when clicked on that link the users will be redirected once again to my website and they will be shown a pdf.
When i did this from my system and localserver it worked fine.
But now my project has been put up in the development server from where its not possible for me to send mail.
I get the following errors
Message: Sys.WebForms.PageRequestManagerServerErrorException: AspPDF.NET 2.0.0.14045 has generated error #46: [ Opening output file failed: Access to the path 'C:\inetpub\wwwroot\Myesign\UploadedFiles\Signed\Support2(1).pdf' is denied. ]
Im not clear that what might be the possible reason for this error. The same project worked when i used the localserver and from my pc also worked fine but from the production server the same project is not working.
Also the link that i get in my mail id is
"http://localhost/ScriptResource.axd?d=n3csX8loR-nh3aSKQ4FNi7Vth7ZBerv1fa-7sJrneEaqqdsyYs5M1zxZ6mXbdwJ0oPXtyofmMkG8z9SZaK8qgo6xYZPs72x4Icy0pXeiYtTxb_JCbdFLZmwvpEToNB0tY6mtEQ2&t=2939b118"
in the above link dont need the "http://localhost/" is there anything i can do about. Im sure there might be some way but im not able to find it.
Can you post the code you use to generate and send the link via email? It may be a relative linking issue. Also, make sure the NTAUTHORITY\NETWORKSERVICE account has permission to read files in the PDF folder on the server, as that is the account used when a file is accessed on the server through IIS.

Not able to delete a file because of IIS

What is the functionality
This web application allows user to upload to web-server, download and delete files uploaded on web-server.
Problem
After downloading a file, when user tries to delete it, an exception is thrown saying this file is being used by another process.
What can be done after download is complete so that IIS releases any lock on the file?
Are you using Server.TransferFile to serve the file from the server? Or you might have something setup in your handlers that causes a similar method to send the files.. The only thing I've seen to unlock the file is to reset IIS :-/
Instead of letting IIS serve the file if you let asp.net send it back in the Response stream then you shouldn't get a problem with the file being locked
also make sure you're disposing of any STream readers that are accessing the files..
If that doesn't help then please post code :-)

Resources