A bad HTTP response code (404) was received when fetching the script. (messaging/failed-service-worker-registration) - notifications

main.556f577fa36f161b.js:1 Unable to get permission to notify. FirebaseError: Messaging: We are unable to register the default service worker. Failed to register a ServiceWorker for scope ('https://website/firebase-cloud-messaging-push-scope') with the script ('https://website/firebase-messaging-sw.js'): A bad HTTP response code (404) was received when fetching the script. (messaging/failed-service-worker-registration).
I am getting this error. it's working fine locally. but after deployment, my address is https://website/project_name so it is unable to find firebase-messaging-sw.js I have tried many ways.
I have followed this tutorial-
https://medium.com/mighty-ghost-hack/angular-8-firebase-cloud-messaging-push-notifications-cc80d9b36f82
I register these files in angular.json
"src/project_name/firebase-messaging-sw.js",
"src/project_name/manifest.json",
like this and deploy locally it works for me but when I deploy it on the main server it doesn't work

Related

WebApi Deployed to IIS: Error: Exceeded maxRedirects. Probably stuck in a redirect loop

I have two Api's that are deployed and running fine in my local IIS. They deploy fine and swagger works but executing any method returns a TypeError: Failed to fetch Error. Then I run the same GET in Postman and it throws Error: Exceeded maxRedirects. Probably stuck in a redirect loop
Has anyone seen this before? We are going through an Azure App Gateway...could that be a problem?
-Ken
The Azure Gateway turned out to be the problem. I commented out the app.UseHttpsRedirection() and the problems went away.

Install cypress using external URL

There is a solution here
but I cannot apply that.
It says I can use this behind a company proxy:
CYPRESS_INSTALL_BINARY=https://company.domain.com/cypress.zip npm install cypress
I've created a JFROG npm repo and uploaded the zip file. When I want to download, I get different errors:
Error: tunneling socket could not be established, statusCode=502
OR
Error: Failed downloading the Cypress binary.
Response code: 401
Response message: Unauthorized
I tried to use a local address (downloaded the zip into C:...) and it works.
EDIT:
The problem was with the proxy and the VPN. Sorry, I couldn't realize. Maybe, in the future, I create my own repo, or use the public one. Or maybe better use a cache.

The CGI application did not return a valid set of HTTP errors. 502.3 - Bad Gateway: Forwarder Connection Error (ARR) on Azure ASP.NET Core App

All of a sudden we are seeing this random error / exception in our web application.
Failed to load resource: the server responded with a status of 502 (Bad Gateway).
In the Log Stream, we are seeing the following details, with specific error code as 502.3 - Bad Gateway: Forwarder Connection Error (ARR).
Also, sometimes in the browser itself we see "The CGI application did not return a valid set of HTTP errors." getting displayed.
Most of the searches for these error codes refer to "IIS / Proxy Server" configuration. But, we haven't changed any such settings.
The error happens very randomly and not specific to any user action/function. Same functionality works first and on second execution immediately after first one throws this error.
How to figure out what is causing this and how to fix?
I google this question, because the program was normal at the beginning, and the subsequent 502.3 error. After I checked the information on the Internet, I feel that it can only give us an inspiration, and it cannot solve your problem immediately.
So my suggestion is that first you browse post1 and post2 I provided.
Next, proceed to Troubleshoot according to the steps of the official documentation. Specific errors require specific analysis.

Spartacus - Error occurred while trying to proxy request

when doing yarn start in spartacus application at localhost , I am getting following error:
[HPM] Error occurred while trying to proxy request /rest/v2/electronics-spa/cms/pages?fields=DEFAULT&pageType=ContentPage&pageLabelOrId=homepage&lang=en&curr=USD from localhost:4200 to https://localhost:
9002 (ECONNREFUSED) (https://nodejs.org/api/errors.html#errors_common_system_errors)
I have pretty standard proxy.bankend.js file. Any suggestions what i can investigate ?
I already tested backend is reachable via url directly.
Regards,
Archit
I am familiar with this situation. Usualy this error happens when the endpoint I an trying to proxy to is not reachable.
Looking at the error I can see your request is still going to https://localhost:9002 so I believe it's possible your proxy might not be picked up.
You should make sure that you specified the proxy config correctly. It can be done in your package.json by modifying the start script: "start": " ng serve --proxy-config proxy/proxy.backend.js", (in this case my proxy is in a proxy folder).
Hope this helps!

How to get proper https server response in apache camel DSL?

I am trying to hit https server using https4 component I want to get whatever response the server throwing it maybe success or failed here is my route.
from("direct:start")
.setHeader(Exchange.HTTP_QUERY,constant("USERNAME=__&PASSWORD=__"))
.to("https4://someAddress.com/api/controls/uploadAndImportFileFromCSV")
.to("stream:out");
Output I'm getting:
org.apache.camel.CamelExecutionException: Exception occurred during execution on the exchange: Exchange[ID-rajat-Lenovo-G50-70-1513247400372-0-1]
org.apache.camel.util.ObjectHelper.wrapCamelExecutionException(ObjectHelper.java:1847)
.........
Caused by: org.apache.camel.http.common.HttpOperationFailedException: HTTP operation failed invoking https4://someAddress.com/api/controls/uploadAndImportFileFromCSV?USERNAME=__&PASSWORD=__ with statusCode: 599
But whenever I hit this URL on web browser I am getting the accurate response what server throws
like {"sessionId":"2985416A1F1122694031261B55F0277F.jvm1","_ERROR_MESSAGE_LIST_":[" The following required parameter is missing: [IN]uploadAndImportFile.configId]","The following required parameter is missing: [IN][uploadAndImportFile.fileTypeEnumId]"],"removePathAlias":false,"loggedIn":true,"USERNAME":"admin","_LOGIN_PASSED_":"TRUE","webSiteId":"API"}
This is what I want to get from camel
After a brief browsing about camel exception randomly I got my solution is already clearly mention on org.apache.camel.http4.
If throwExceptionOnFailure=false the HttpOperationFailedException will not be thrown for failed response codes. This allows you to get any response from the remote server.
from("direct:start")....to("https4://.......?throwExceptionOnFailure=false")