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

Sentry Envelopes/Tunnel #193

Open
ALameLlama opened this issue Jun 6, 2024 · 2 comments
Open

Sentry Envelopes/Tunnel #193

ALameLlama opened this issue Jun 6, 2024 · 2 comments
Assignees
Labels
help wanted Extra attention is needed module [Sentry]
Milestone

Comments

@ALameLlama
Copy link

I have a PHP project and some JS on the FE, the PHP Sentry stuff works great but I've run into issues trying to get the JS side working with buggregator.

Doing the using a tunnel results in Client error: POST http:https://127.0.0.1:8000/api/1/envelope/` resulted in a 404 Not Found responseand trying to use it directly with the tunnel results inserver_name is undefined` on https://github.com/buggregator/server/blob/master/app/modules/Sentry/Application/Mapper/EventTypeMapper.php#L28

https://develop.sentry.dev/sdk/envelopes/
https://docs.sentry.io/platforms/javascript/troubleshooting/

Both of these work on production sentry

@butschster
Copy link
Member

Hey there! It looks like your JavaScript side is having a bit of trouble connecting with Buggregator due to some missing or incorrect settings. Here's how you can try to fix it:

  1. Set the Environment Variable: Make sure you have the correct environment variable set up in your Buggregator Docker configuration. This tells your JavaScript where to send error reports.

You can set it like this in your environment file (.env):

SENTRY_JS_DSN_HOST=http:https://sentry@server_name:8000

Replace server_name with the actual name of your server. This should match the setup you have for your PHP project if that's working well.

  1. Check the Configuration Guide: Double-check the settings by looking at the configuration guide for Buggregator. You might find some extra steps or requirements that you missed. Here’s a helpful link: https://docs.buggregator.dev/config/sentry.html#configuration-3

@butschster butschster self-assigned this Jun 8, 2024
@butschster butschster added help wanted Extra attention is needed module [Sentry] labels Jun 8, 2024
@butschster butschster added this to the 1.0 milestone Jun 8, 2024
@ALameLlama
Copy link
Author

ALameLlama commented Jun 18, 2024

Thanks for the reply, I am trying to setup envelope since this is what well end up getting used on release.

The JS has this but im not sure this matters since it sends the request to the tunnel and the PHP backend is what is actually sending the request.

Sentry.init({
    dsn: import.meta.env.VITE_SENTRY_ALERT_DSN,
    tunnel: "/sentry",
});

the PHP code is using guzzle and looks like so

        try {
            $response = (new Client())->post("$protocol:https://$host/api/$id/envelope/", [
                'headers' => [
                    'Content-Type' => 'application/x-sentry-envelope',
                ],
                'body' => $data
            ]);
        } catch (Throwable $e) {
            $this->response->setStatusCode(500, 'Failed to send to Sentry');

            return $this->response;
        }

This ends up throwing this

Client error: POST http:https://127.0.0.1:8000/api/1/envelope/ resulted in a 404 Not Found response`

Using the same DSN http:https://[email protected]:8000/1 results in successful error logs when calling it directly via the PHP sentry client which works amazing.

    Sentry\init([
        'dsn' => 'http:https://[email protected]:8000/1',
    ]);

    Sentry\captureMessage('Test');

Setting this up to point to a real sentry DSN results in both of them working so it's only buggregator that doesn't allow envelopes to work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed module [Sentry]
Projects
Status: No status
Development

No branches or pull requests

2 participants