I tried to get a response from the server using axios, but then my web application froze instantly when the response was received by the client side
i got the error like this in my console
Failed to register/update a ServiceWorker for scope
‘http://localhost:3000/’: Load failed with status 404 for script
‘http://localhost:3000/sw.js’.
Related
im trying to get the response of an api call on my chrome console but it kept spitting could not laod response 404
this is the main response
main.js:62 GET http://localhost:3000/[object%20Object] 404 (Not Found)
So, I have a rest api developed in Express. For authentication, I'm using cookies and to fetch user info I just do a get request to an endpoint that return me user info if its logged in or a 401 (Unauthorized) status code if its not. My concern is about, when I get a 401 status code, the chrome developer console print
Failed to load resource: the server responded with a status of 401
(Unauthorized)
It does not cause any bug in the client, just that It bothers me to see it hah.
Create an interceptor in the HTTP requests and upon received response, use the single line code console.clear(); to clear the console output.
In that way, even if you receive 401 or 403 or any response from server and a console error/warning is auto generated, then it will be auto cleared as well!
I am trying to load a page when it is done with certain processes. When the process is still running, it returns a 503 error code, when the page is loaded, it returns a 200 code.
I am doing this via the $.get function. However, when jQuery get's a 503 error code (and probably also with other error codes), it logs this in the console:
XHR failed loading: GET "URL".
Example:
How do I remove this console.log()?
The logging entry in chrome's console is a behaviour of chrome when any HTTP request is handled, not a problem with jQuery or ajax(XMLHttpRequest), even an or tag could cause this issue.
So you cannot stop the chrome browser from logging 503 errors in console. Instead you should correct the server side implementation. The server should return 200 even if the process is running, with a response data indicating that the process is running. (You may run your process in background thread on the server asynchronously and return the response on the main thread.)
Any thoughts on why I'm getting a "Failed to load resource: the server responded with a status of 400 (Bad Request)" in the Javascript on my client? (client-id obscured, I have one for an Oauth2.0 app via registration Rdio site)
index.html:
<script src="https://www.rdio.com/api/api.js?client_id=12345678"></script>
response:
https://www.rdio.com/oauth2/authorize/auto?response_type=token&client_id=12345678&showSignup=true&redirect_uri=http%3A%2F%2Flocalhost%3A8080%2Fhelper.html%3Fclient_id%3D12345678
Failed to load resource: the server responded with a status of 400 (Bad Request)
John
The response text from the https://www.rdio.com/oauth2/authorize/auto request should reveal the error. For example, making a request from the shell:
$ curl "https://www.rdio.com/oauth2/authorize/auto?response_type=token&client_id=12345678&showSignup=true&redirect_uri=http%3A%2F%2Flocalhost%3A8080%2Fhelper.html%3Fclient_id%3D1234567"
For a valid client ID, a possible response might be:
Invalid redirect_uri
If this is the error you're receiving, which seems likely, to resolve it, you need to add your redirect_uri's domain to the Redirect URIs in your Rdio application's settings.
I want to have a javascript client process get the HTTP status code that a server is returning when the client makes a websocket upgrade request and that request is unsuccessful.
I have my server returning HTTP 400 to indicate that a websocket upgrade is unsuccessful.
I am using Google Chrome and when i open the developer console I can see the following message:
WebSocket connection to 'wss://' failed: Error during WebSocket handshake: Unexpected response code: 400
However, the onerror handler does not contain this message, it receives a 1006 error but does not indicate that the closure occured as a result of getting HTTP 400.
How does a javascript developer handle handshake errors? I would like to provide the client with an informative message when they get a handshake error.
I have put the websocket error below, it does not seem to contain anything that I can use to indicate that this error is a result of a websocket handshake error.
Websocket Error: {"path":{"length":0},"cancelBubble":false,"returnValue":true,"srcElement":{"binaryType":"blob","protocol":"","extensions":"","bufferedAmount":0,"readyState":3,"url":"wss://<my address>","URL":"wss://<my address>"},"defaultPrevented":false,"timeStamp":1417828938039,"cancelable":false,"bubbles":false,"eventPhase":2,"currentTarget":{"binaryType":"blob","protocol":"","extensions":"","bufferedAmount":0,"readyState":3,"url":"wss://<my address>","URL":"wss://<my address>"},"target":{"binaryType":"blob","protocol":"","extensions":"","bufferedAmount":0,"readyState":3,"url":"wss://<my address>","URL":"wss://<my address>"},"type":"error"}
I am afraid there is no way from Javascript to know the HTTP status code of the negotiation.
There are defined closing codes, and 1006 only means that the connection is closed abruptly, but the protocol even allows to close the connection without providing a reason. That, together with the readyState API, are the only tools you have to diagnosed the reason of the problem.