sentry-capacitor icon indicating copy to clipboard operation
sentry-capacitor copied to clipboard

Angular 18 Support.

Open sebsoftpak opened this issue 1 year ago β€’ 7 comments

At this moment, we are not able to update to Angular 18 with @sentry/capacitor, because it is pinned to @sentry/[email protected], which on it's turn does not allow Angular 18.

Angular 18 seems to be supported by version 8.x of the Sentry Javascript SDK. https://github.com/getsentry/sentry-javascript/discussions/12377

npm ERR! code ERESOLVE npm ERR! ERESOLVE could not resolve npm ERR! npm ERR! While resolving: @sentry/[email protected] npm ERR! Found: @angular/[email protected] npm ERR! node_modules/@angular/common npm ERR! @angular/common@"^18.0.3" from the root project npm ERR! peer @angular/common@"18.0.3" from @angular/[email protected] npm ERR! node_modules/@angular/forms npm ERR! @angular/forms@"^18.0.3" from the root project npm ERR! peer @angular/forms@">=16.0.0" from @ionic/[email protected] npm ERR! node_modules/@ionic/angular npm ERR! @ionic/angular@"^8.2.2" from the root project npm ERR! 6 more (@angular/platform-browser, ...) npm ERR! npm ERR! Could not resolve dependency: npm ERR! peer @angular/common@">= 10.x <= 15.x" from @sentry/[email protected] npm ERR! node_modules/@sentry/angular npm ERR! @sentry/angular@"7.114.0" from the root project npm ERR! peerOptional @sentry/angular@"7.114.0" from @sentry/[email protected] npm ERR! node_modules/@sentry/capacitor npm ERR! @sentry/capacitor@"^0.18.0" from the root project npm ERR! npm ERR! Conflicting peer dependency: @angular/[email protected] npm ERR! node_modules/@angular/common npm ERR! peer @angular/common@">= 10.x <= 15.x" from @sentry/[email protected] npm ERR! node_modules/@sentry/angular npm ERR! @sentry/angular@"7.114.0" from the root project npm ERR! peerOptional @sentry/angular@"7.114.0" from @sentry/[email protected] npm ERR! node_modules/@sentry/capacitor npm ERR! @sentry/capacitor@"^0.18.0" from the root project npm ERR! npm ERR! Fix the upstream dependency conflict, or retry npm ERR! this command with --force or --legacy-peer-deps npm ERR! to accept an incorrect (and potentially broken) dependency resolution.

sebsoftpak avatar Jun 14 '24 12:06 sebsoftpak

Thank you for opening this issue! I'll check internally what'll be the best short term solution for this issue and I'll update this issue as soon as I get a response!

lucas-zimerman avatar Jun 14 '24 21:06 lucas-zimerman

While official support for Angular 18 is still in progress, you can use the following npm command to ensure compatibility with the current version of Sentry Capacitor: npm install --legacy-peer-dep. Keep in mind that this isn’t the ideal solution, but based on my tests, the latest supported version of Sentry Angular Ivy works with Angular 18. Note that Sentry JavaScript V8 has significant breaking changes, so an update for Capacitor may take some time 😊

lucas-zimerman avatar Jun 20 '24 14:06 lucas-zimerman

Hi there! Has there been any updates on when this is expected to be implemented? We'd really rather not use legacy-peer-dep in our projects as this could have potential long term ramifications, especially with other packages, but as @sebsoftpak notes, this is blocking updating Angular to the latest version for anyone that will use this package.

Thanks!

JackLazenbyZigzag avatar Jun 27 '24 20:06 JackLazenbyZigzag

@JackLazenbyZigzag in the meantime, I've uninstalled @sentry/capacitor, and changed to @sentry/angular for the time being. It's not the same ofcourse, but at least we get the Javascript errors in the meantime - and we were still able to continue upgrading all other dependencies. In our apps it was quite easy to switch between the two. And will change it back, once the new version is ready.

sebsoftpak avatar Jun 28 '24 06:06 sebsoftpak

That's also another option if you can't wait for the new release, as @sebsoftpak suggested using @sentry/angular for the moment is another option if the --legacy-peer-dep isn't the best option (it would be great if --legacy-peer-dep could be applied to a single package but from what i saw it's not an option).

To support angular 18 we have to bump to SentryJavascript V8, that contains some big break changes, because of that it's not gonna be a fast update compared to the other bumps.

Support for V8 is currently in progress and is expected to be ready in about 2 to 3 weeks.

lucas-zimerman avatar Jun 28 '24 12:06 lucas-zimerman

Sounds great, will you share a next or beta tag we can early test? Would be nice since cocoa will also fail atm without -ivy package

muuvmuuv avatar Jul 02 '24 17:07 muuvmuuv

Sounds great, will you share a next or beta tag we can early test? Would be nice since cocoa will also fail atm without -ivy package

We will release the next release as beta.

lucas-zimerman avatar Jul 04 '24 13:07 lucas-zimerman

As a temp solution, I added the following to the bottom of my package.json

  "overrides": {
    "@sentry/angular-ivy": {
      "@angular/core": "^18.0.0",
      "@angular/common": "^18.0.0",
      "@angular/router": "^18.0.0"
    }
  }

DavidBowdoin avatar Jul 10 '24 16:07 DavidBowdoin

Hey @lucas-zimerman any new on this update? Thank you ! πŸ™

MaximeSIMET avatar Jul 25 '24 13:07 MaximeSIMET

Hey @lucas-zimerman any new on this update? Thank you ! πŸ™

+1

neogenz avatar Jul 26 '24 11:07 neogenz

Hey @lucas-zimerman any new on this update? Thank you ! πŸ™

+1

mwyld avatar Jul 29 '24 22:07 mwyld

Sorry for the late response, version 1.0.0-beta.1 should contain all the fixes to support angular 18

lucas-zimerman avatar Jul 31 '24 18:07 lucas-zimerman

@lucas-zimerman Thanks! It seems not yet released to npm, is that process automated or does someone upload it manually?

muuvmuuv avatar Aug 02 '24 07:08 muuvmuuv

Hi @lucas-zimerman thank you so much for your work. I just wanted to ask if you have any ETA for the release of version 1? Thanks

djabif avatar Aug 02 '24 14:08 djabif

@lucas-zimerman any update about the release of v1 ? Thank you!

MaximeSIMET avatar Aug 27 '24 07:08 MaximeSIMET

@MaximeSIMET this currently works, in package.json

    "@sentry/angular": "8.9.2",
    "@sentry/capacitor": "1.0.0-beta.1",

DavidBowdoin avatar Aug 27 '24 18:08 DavidBowdoin

I tried already but got this issue on package import with this specific version:

TS2307: Cannot find module @sentry/capacitor or its corresponding type declarations. import * as Sentry from '@sentry/capacitor';

@MaximeSIMET this currently works, in package.json

    "@sentry/angular": "8.9.2",
    "@sentry/capacitor": "1.0.0-beta.1",

MaximeSIMET avatar Aug 28 '24 07:08 MaximeSIMET

@MaximeSIMET this currently works, in package.json

    "@sentry/angular": "8.9.2",
    "@sentry/capacitor": "1.0.0-beta.1",

is this also recommended for angular 17? Since I am getting the same original error with Angular 17, so I thought I might use the Angular-18-version-fix

folsze avatar Sep 17 '24 09:09 folsze