Skip to content

Create server runtime Client in @sentry/core #8693

Description

@mydea

Kind of extracted from #8087, and related to #8688, create a new ServerRuntimeClient (name tbd) as well as an init in @sentry/core. The idea is that this can be called from any JS runtime, so browser, node, edge, ... so it should only contain stuff that works everywhere.

For the first step, we can just implement this based on the EdgeClient from Next.js, as well as an init() method based on the edge init.

In follow up steps, we can then actually extend from this for node/serverless SDKs, and re-use as much as possible.

### Tasks
- [ ] https://github.com/getsentry/sentry-javascript/pull/8930
- [ ] https://github.com/getsentry/sentry-javascript/pull/8932
- [ ] https://github.com/getsentry/sentry-javascript/pull/8933
- [x] Use `ServerRuntimeClient` in serverless (TODO: Or continue using node?)
- [x] Stretch goal: Use `ServerRuntimeClient` in Sveltekit

Activity

  1. AbhiPrasad commented on Aug 1, 2023

    @AbhiPrasad
    Contributor

    Why core client over base client?

    We want base client to be as minimal as possible to save on bundle size in browser, hence the previous proposal to have a wintercg client that only was used for backend runtimes.

  2. mydea commented on Aug 1, 2023

    @mydea
    MemberAuthor

    Why core client over base client?

    We want base client to be as minimal as possible to save on bundle size in browser, hence the previous proposal to have a wintercg client that only was used for backend runtimes.

    Based on the current "EdgeClient" implementation, I didn't see a lot that wouldn't go into the browser client (but TBH I just skimmed this, so maybe missed something). Do you think there is stuff in there that wouldn't work (or we wouldn't want) in browser? If so, then yes we should extract this into a dedicated init only for backend runtimes!

  3. mydea commented on Aug 1, 2023

    @mydea
    MemberAuthor

    Otherwise, based on talk with @kamilogorek , let's go with a new package like @sentry/js that we may end up also using with browser, or not if it doesn't make sense? We don't really want to expose the WinterGC naming in the package I think, so we'd need to use something else that makes sense 😅

    Or another name idea: @sentry/server?

  4. AbhiPrasad commented on Aug 1, 2023

    @AbhiPrasad
    Contributor

    Remix uses https://www.npmjs.com/package/@remix-run/server-runtime, I think @sentry/server-runtime could work well here!

    Based on the current "EdgeClient" implementation, I didn't see a lot that wouldn't go into the browser client

    The main thing at the moment is crons, but I can see other stuff also getting added (request mode sessions, metrics APIs, etc.).

  5. mydea commented on Aug 1, 2023

    @mydea
    MemberAuthor

    server-runtime sounds good to me as well! I'll update the issue (we can still tweak it more) 🚀

  6. changed the title [-]Create `CoreClient` & `Core.init`[/-] [+]Create `@sentry/server-runtime` with basic Client & init[/+] on Aug 1, 2023
  7. AbhiPrasad commented on Aug 31, 2023

    @AbhiPrasad
    Contributor

    After some discussion with @timfish and @lforst it was decided that a separate package is not needed. Instead we can just put the Server runtime client (name tbd) into @sentry/core.

  8. changed the title [-]Create `@sentry/server-runtime` with basic Client & init[/-] [+]Create server runtime Client & init in `@sentry/core`[/+] on Aug 31, 2023
  9. changed the title [-]Create server runtime Client & init in `@sentry/core`[/-] [+]Create server runtime Client in `@sentry/core`[/+] on Sep 14, 2023
  10. AbhiPrasad commented on Sep 18, 2023

    @AbhiPrasad
    Contributor

    Going to close this as we're not going to do the serverless change and we're going to track Sveltekit in another issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions