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

Document Angular SDK installation for standalone component Angular projects #8342

Closed
Lms24 opened this issue Oct 27, 2023 · 9 comments · Fixed by #11356
Closed

Document Angular SDK installation for standalone component Angular projects #8342

Lms24 opened this issue Oct 27, 2023 · 9 comments · Fixed by #11356
Assignees

Comments

@Lms24
Copy link
Member

Lms24 commented Oct 27, 2023

Core or SDK?

Platform/SDK

Which part? Which one?

@sentry/angular-ivy

Description

Since Angular 16 (I belive), entire Angular applications can created without declaring a single NgModule, by only using standalone components.

We currently instruct users to declare our providers (ErrorHandler, TraceService) in app.module.ts which doesn't exist in this case.

Suggested Solution

Add instructions how to declare providers in app.config.ts. There are no big differences except for the used Angular API but we should nevertheless cover this in our docs.

Kind of blocked on getsentry/sentry-javascript#9376 since I first want to figure out the best course of action around using the SDK in SSR Angular 17 apps.

@Lms24 Lms24 self-assigned this Oct 27, 2023
@zip-fa
Copy link

zip-fa commented Oct 27, 2023

I suggest you to create dedicated provideSentryErrorHandler() function, which will do this under-the-hood:

import { createErrorHandler } from ‘@sentry/angular-ivy’;

export function provideSentryErrorHandler(opts: SomeOptsType = {}) {
return {
      provide: ErrorHandler,
      useValue: createErrorHandler(opts)
    }
}

and use it in standalone application just by calling this fn like this:

providers: [
provideSentryErrorHandler({ showDialog: true })
]

@getsantry getsantry bot moved this to Waiting for: Product Owner in GitHub Issues with 👀 Oct 27, 2023
@Lms24
Copy link
Member Author

Lms24 commented Oct 27, 2023

Good idea! Would you be interested in opening a PR for this? No worries if not, I'll get to it next week.

@zip-fa
Copy link

zip-fa commented Oct 27, 2023

PR for provider fn or for docs?:)

@Lms24
Copy link
Member Author

Lms24 commented Oct 30, 2023

@zip-fa I was thinking about the provider helper functions but any help is appreciated :)

I wrote up an issue to track the provider functions in the SDK repo: getsentry/sentry-javascript#9407.

@getsantry
Copy link
Contributor

getsantry bot commented Nov 8, 2023

Routing to @getsentry/product-owners-sdks-web-frontend for triage ⏲️

@vadimcoder
Copy link

We need this

@getsantry getsantry bot moved this to Waiting for: Product Owner in GitHub Issues with 👀 3 Jun 11, 2024
@OAuthority
Copy link

Is there any update for this, please?

@Lms24
Copy link
Member Author

Lms24 commented Jun 12, 2024

Hey, sorry, no updates. The SDK works in NGModule-less angular apps. It's not ideal but for now, to set up the SDK you can refer to an example app we use to E2E test the Angular SDK:

I bumped the prio for writing the guide but can't give ETAs, sorry (too much stuff going on 😢)

@garytube
Copy link

garytube commented Sep 4, 2024

@Lms24 thx for the example. Hope to see it soon in the docs

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

7 participants