How to fix Service worker registration failed in angular? - push-notification

I am trying to use angular push notification feature. For that I am using below link example.
https://blog.angular-university.io/angular-push-notifications/
But while running this I am getting below error.
service-worker.js:711 Service worker registration failed with: TypeError: Failed to register a ServiceWorker for scope ('http://localhost:4200/') with script ('http://localhost:4200/ngsw-worker.js'): A bad HTTP response code (404) was received when fetching the script.
For detailed code refer below link
https://github.com/angular-university/angular-pwa-course/tree/1-notifications-finished
Please help me on this to resolve

Related

Symfony Mailer with SendinBlue configuration problem

I am trying do deploy my website, and i'm using a third party transport to dispatch my emails like : confirmation after subscription and reset password emails.
I am using SendinBlue. I followed Symfony documentation and run composer require symfony/sendinblue-mailer
Then i added MAILER_DSN=sendinblue+smtp://USERNAME:PASSWORD#default in my .env file. Username and password seems correct, i also encoded special characters in my username.
My website is hosted on OVH, i can connect by SSH and run php bin/console messenger:consume async
I have an error message saying : WARNING [messenger] Error thrown while handling message Symfony\Component\Mailer\Messenger\SendEmailMessage. Sending for retry #1 using 1000 ms delay. Error: "Handling "Symfony\Component\Mailer\Messenger\SendEmailMessage" failed: Connection could not be established with host "ssl://smtp-relay.sendinblue.com:587": stream_socket_client(): unable to connect to ssl://smtp-relay.sendinblue.com:587 (Connection refused)"
I also tried to use the SendinBlue API key and got this message : WARNING [messenger] Error thrown while handling message Symfony\Component\Mailer\Messenger\SendEmailMessage. Sending for retry #1 using 1000 ms delay. Error: "Handling "Symfony\Component\Mailer\Messenger\SendEmailMessage" failed: Could not reach the remote Sendinblue server."
I guess i missed something, it's the first time i build a symfony application and im a little lost. I spent all day on this and could not find a solution.
Does anyone have an idea what i did wrong ?

AccessDeniedExceptionnull (Service: AWSLambdaInternal; Status Code: 403 Amplify

I have issues pushing to amplify after adding resource same problem, after adding auth with
amplify add auth
amplify push
I get
Following resources failed
Resource Name: UserPoolClientLambda (AWS::Lambda::Function)
Event Type: create
Reason: AccessDeniedExceptionnull (Service: AWSLambdaInternal; Status Code: 403; Error Code: AccessDeniedException; Request ID: 8434d2a2-4287-4b79-b22f-5d95094436a0; Proxy: null)
× An error occurred when pushing the resources to the cloud
Resource is not in the state stackUpdateComplete
An error occurred during the push operation: Resource is not in the state stackUpdateComplete
How I resolve this ?
PS: amplify cli is version 4.41.2
Finally able to figure it out.
My issue has something to do with my exposed api key case with my users.
I had help from the AWS support. Initially, I was just going to fix my billing payment method, and they mentioned that they locked my account due to the exposed api key. They walked me through it to rotate my API key and I just waited around 3-5 hours to get my account unlocked.
I tried it after following the same steps and it worked
$ amplify add auth
$ amplify push

firebase.messaging.deleteToken() FAILED when deleting token

I am trying stop web browser from receiving notification for cases where user logs out/ when oauth refresh token timeout (forced logout).
But when calling method firebase.messaging.deleteToken() with a valid token passed in as parameter, I keep getting errors "A problem occurred while unsubscribing the user from FCM: Requested entity was not found. (messaging/token-unsubscribe-failed)".
My use case and issue is same as described here, except for the part that I am using firebase 7.24.0.
I can't downgrade to firebase version 7.6.1(it is mentioned as a solution in the above mentioned GitHub thread) because I am also using messaging.onBackgroundMessage() and it has been added recently.

How to use Firebase behind Firewall / Proxy?

We are running a simple application that connects to Firebase are reads some data. It fails to connect with the following timeout error:
#firebase/database: FIREBASE WARNING: {"code":"app/invalid-credential",
"message":"Credential implementation provided to initializeApp()
via the \"credential\" property failed to fetch a valid Google OAuth2 access token
with the following error: \"Failed to parse access token response: Error: Error
while making request: connect ETIMEDOUT
We are behind Firewall / Proxy and it appears that is blocking traffic to/from Firebase and hence failed connection. My question is what ports need to be opened and to what destination URLs to make this application work normally?
Any help will be much appreciated!
Finally, after struggling with the issue for several days got it working. Needed to contact network team and request to perform following actions:
Open ports 5228, 5229, 5230 for Firebase communication.
Opened communication at proxy level between the source server and following URLs:
fcm.googleapis.com
gcm-http.googleapis.com
accounts.google.com
{project-name}.firebaseio.com
Added following code in my node.js application:
var globalTunnel = require('global-tunnel-ng');
globalTunnel.initialize({
host: '<proxy-url>',
port: <proxy-port>,
//proxyAuth: 'userId:password', // optional authentication
sockets: 50 // optional pool size for each http and https
});
Installed module global-tunnel-ng:
npm install global-tunnel-ng
It solved the my problem and I hope it can help others too. :-)
I used Wireshark to monitor a local install of a Node.js application using the Admin SDK for firestore. I also referenced this list by Netify. This is what I found:
*.firebaseio.com
*.google.com
*.google-analytics.com
*.googleapis.com
*.firebase.com
*.firebaseapp.com

reCaptcha validation with timeout exception

I am using reCaptch in my MVC 3 web app running in the localhost.
Things were working fine few weeks back but suddenly failing.
Suddenly getting this error.
if(!ReCaptcha.Validate(_config.RecaptchaPrivateKey)){ <-- times out here
//process other fields in the form
}
As soon as I fill the form and hot submit I get this error :
The operation has timed out
Description : An unhandled exception occurred during the execution of the current ...
Exception Details : System.Net.WebException: The operation has timed out
Is this a proxy issue?
Is this because my site on localhost runs on port 3316?
localhost:3316/user/signup
I saw some posts that suggests that reCAPTCHA expects port 80 but my app runs on port 3316
What can be the issue?
Thanks
I got around this by creating proxy class that inherits IWebProxy.
Then specifying to use this proxy when internal, I had to transform it out for other environments that didn't need to use it.
See this question and accepted answer:
Is it possible to specify proxy credentials in your web.config?
The above link took some finding, so I favourited it for future use.

Resources