Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[HELP] POST Request is being blocked with a 504 error #567

Closed
jvinters opened this issue Apr 25, 2024 · 7 comments
Closed

[HELP] POST Request is being blocked with a 504 error #567

jvinters opened this issue Apr 25, 2024 · 7 comments

Comments

@jvinters
Copy link

Posted tracing requests are being blocked with a 504 error (service worker)

Instrumentation seems to be working correctly, spans are being generated, when the request is POSTed there's a 504 blocked error. I can take the same request and send it from postman with no issue.

On a Angular 18, with service worker.

I believe its an issue with the server worker blocking the request.

How can I add a header (ngsw-bypass=true) to each tracing request? I tried an HttpInterceptor but I assume the service has its own HttpClient dependency so I cannot figure out how to supply my own Interceptor.

@codecapitano
Copy link
Collaborator

codecapitano commented Apr 25, 2024

Hi @jvinters
Yes Faro has it's own services to send data, called transports.

By default Faro uses the FetchTransport.
The FetchTransport allows you to add custom headers.

To do so, you need to initialize a customized FetchTransport in the Faro init code.

initializeFaro({
  // ...

  transports: [
    new FetchTransport({
      url: `http://my-endpoint/collect/api-key`,
      requestOptions: {
        headers: { foo: 'bar' },
      },
    }),
  ],

  // ...
});

@jvinters
Copy link
Author

Hello, thanks for the quick response.

I was able to add the headers with the above code. The request is still failing. Now the status just says "blocked:other" and the console says "ERR_BLOCKED_BY_CLIENT" and "TypeError: Failed to fetch".

Any ideas on how to solve this?

@codecapitano
Copy link
Collaborator

@jvinters could you solve the problem and can we close the issue?

@jvinters
Copy link
Author

@codecapitano No I cannot solve this problem, which Is why I asked for help. Please reopen, this issue is not closed.

@codecapitano codecapitano reopened this Apr 29, 2024
@codecapitano
Copy link
Collaborator

Oh dang, I closed the issue by accident.

@codecapitano
Copy link
Collaborator

@jvinters do you have any privacy extensions like adblockers running?
The ERR_BLOCKED_BY_CLIENT mostly occurs when an extension is blocking a request.

Does it happen when all extensions are turned off (also the built-in extensions of the browser, if any).

@jvinters
Copy link
Author

jvinters commented May 2, 2024

@codecapitano Yes it happens with adblock disabled. Also happens on firefox and edge which don't have any extensions.

@jvinters jvinters closed this as completed May 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants