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

Release health sessions not sent when using a direct client #14804

Open
3 tasks done
rodolfoBee opened this issue Dec 19, 2024 · 5 comments
Open
3 tasks done

Release health sessions not sent when using a direct client #14804

rodolfoBee opened this issue Dec 19, 2024 · 5 comments
Assignees
Labels
Package: browser Issues related to the Sentry Browser SDK

Comments

@rodolfoBee
Copy link
Member

Is there an existing issue for this?

How do you use Sentry?

Sentry Saas (sentry.io)

Which SDK are you using?

@sentry/browser

SDK Version

"@sentry/browser": "^8.47.0"

Framework Version

No response

Link to Sentry event

No response

Reproduction Example/SDK Setup

import {
  BrowserClient,
  defaultStackParser,
  getDefaultIntegrations,
  browserSessionIntegration,
  makeFetchTransport,
  Scope,
} from "@sentry/browser";

// filter integrations that use the global variable
const integrations = getDefaultIntegrations({}).filter(
  (defaultIntegration) => {
    return !["BrowserApiErrors", "Breadcrumbs", "GlobalHandlers"].includes(
      defaultIntegration.name,
    );
  },
);

const client = new BrowserClient({
  dsn: "...",
  transport: makeFetchTransport,
  stackParser: defaultStackParser,
  integrations: [ ...integrations, browserSessionIntegration()],
  release:"[email protected]",
  autoSessionTracking:true,
  initialScope: {
    user: { id: 42, email: "[email protected]" },
  },
});

const scope = new Scope();
scope.setClient(client);

client.init(); // initializing has to be done after setting the client on the scope
// rest of the logic

Steps to Reproduce

  1. Run a simple app with the configuration above

Expected Result

The SDK sends release health sessions to Sentry to track release health and adoption on the Releases page.

Actual Result

No release session event is sent to Sentry.

Explicitly setting the browserSessionIntegration integration and/or autoSessionTracking have no effect on the result, this should also be automatic when a release version is set in the init as per:

@getsantry getsantry bot moved this to Waiting for: Product Owner in GitHub Issues with 👀 3 Dec 19, 2024
@github-actions github-actions bot added the Package: browser Issues related to the Sentry Browser SDK label Dec 19, 2024
@s1gr1d
Copy link
Member

s1gr1d commented Dec 20, 2024

Hello,
I'm gonna try to reproduce this. But one follow-up questions: How does the application look like where Sentry is running? Is this a browser extension or any other shared environment as a BrowserClient is explicitly created?

@ionutholbia
Copy link

@s1gr1d In our case Sentry is initialized in the service worker of a browser extension. I think @rodolfoBee also reproduced the issue but now sure how he tested.

@getsantry getsantry bot moved this to Waiting for: Product Owner in GitHub Issues with 👀 3 Dec 20, 2024
@s1gr1d
Copy link
Member

s1gr1d commented Dec 20, 2024

in the service worker of a browser extension

The BrowserSession integration might not be set up correctly. Can you enable debug: true and check if you get a warning like this: "Using the browserSessionIntegration in non-browser environments is not supported.".

The SDK checks if WINDOW.document is available. I just want to check if you're running into this condition.

@ionutholbia
Copy link

ionutholbia commented Dec 20, 2024

Image

The first print is mine.

Haven't received a print like: "Using the browserSessionIntegration in non-browser environments is not supported."

Maybe it's worth mentioning that if I initialize Sentry on a global scope using Sentry.init then Release healthy sessions work fine.

@getsantry getsantry bot moved this to Waiting for: Product Owner in GitHub Issues with 👀 3 Dec 20, 2024
@s1gr1d
Copy link
Member

s1gr1d commented Dec 20, 2024

Thanks for this information! I'll look into this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Package: browser Issues related to the Sentry Browser SDK
Projects
Status: No status
Development

No branches or pull requests

3 participants