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

[iOS] Upload Debug Symbols Sentry - ERROR (invalid URL and invalid TOKEN) #3085

Closed
5 of 11 tasks
whyamsx opened this issue May 23, 2023 · 9 comments
Closed
5 of 11 tasks

Comments

@whyamsx
Copy link

whyamsx commented May 23, 2023

OS:

  • Windows
  • MacOS
  • Linux

Platform:

  • iOS
  • Android

SDK:

  • @sentry/react-native (>= 1.0.0)
  • react-native-sentry (<= 0.43.2)

SDK version: 4.0.0

react-native version: 0.71.4

Are you using Expo?

  • Yes
  • No

Are you using sentry.io or on-premise?

  • sentry.io (SaaS)
  • on-premise

If you are using sentry.io, please post a link to your issue so we can take a look:

[Link to issue]

Configuration:

(@sentry/react-native)

Sentry.init({
  dsn: 'https://...@sentry.io/...'
});

I have following issue:

I followed all the installation steps in the documentation and even automatically implemented everything through the cli, but after trying to run the iOS project, I get an error saying that my DSN cannot be the root link for Sentry, I read about this in other Issues and everyone writes that you need to change the default.url to a regular Sentry domain, but then I get another problem, with such a link, the token does not fit in the url, because it was made exactly for the DSN that was specified there (in ios/sentry.properties), and how should I be? I've been put into despair

Steps to reproduce:
Just install according to the documentation 🤷‍♂️

Actual result:

Doesn't accept default.url with my DSN, otherwise following community advice it accepts default.url but doesn't accept token that is issued specifically for my DSN.

Expected result:

I just want to run a working Sentry on iOS.

@krystofwoldrich
Copy link
Member

Hi,
could you share a link to the docs page you used, so we know exactly the steps you have taken? Was it this page?

The default.url can't be a DSN, this is only used for changing the domain in case you self-host Sentry.

This seems like you are using the wrong auth token.

Here are steps on how to create the correct auth token.

@whyamsx
Copy link
Author

whyamsx commented May 23, 2023

Hi,
could you share a link to the docs page you used, so we know exactly the steps you have taken? Was it this page?

The default.url can't be a DSN, this is only used for changing the domain in case you self-host Sentry.

This seems like you are using the wrong auth token.

Here are steps on how to create the correct auth token.

Hi, i'm used this documentation

And I also want to point out that what you wrote about the token, I could think the same, but then why does it work for Android?
My sentry.properties in Android was identical and it works fine, but it doesn't work for iOS, and this file was added not by my hands but with npx @sentry/wizard -s -i reactNative, that is, this should reduce the chance of an error with my hand is very strong

@krystofwoldrich
Copy link
Member

I see, you mentioned npx @sentry/wizard -s -i reactNative but in the issue details you mentioned you are using version 4.0.0 of sentry-react-native.

Can you try this with the latest SDK version? If not can you try this: https://docs.sentry.io/platforms/react-native/troubleshooting#set-up-skd-v4-with-react-native-069-or-higher

If you still run into the same issue, can you add --log-level=debug --force-foreground to the build phase where sentry-cli is executed and send out the output?

COMMAND="$SENTRY_CLI react-native xcode --log-level=debug --force-foreground $REACT_NATIVE_XCODE"
/bin/sh -c "$WITH_ENVIRONMENT \"$COMMAND\""

@whyamsx
Copy link
Author

whyamsx commented May 23, 2023

I see, you mentioned npx @sentry/wizard -s -i reactNative but in the issue details you mentioned you are using version 4.0.0 of sentry-react-native.

Can you try this with the latest SDK version? If not can you try this: https://docs.sentry.io/platforms/react-native/troubleshooting#set-up-skd-v4-with-react-native-069-or-higher

If you still run into the same issue, can you add --log-level=debug --force-foreground to the build phase where sentry-cli is executed and send out the output?

COMMAND="$SENTRY_CLI react-native xcode --log-level=debug --force-foreground $REACT_NATIVE_XCODE"
/bin/sh -c "$WITH_ENVIRONMENT \"$COMMAND\""

I tried updating @sentry/react-native version to ^5.5.0 but that didn't solve my problem
I also tried to add flags to the launch of the sentry, which you described, but the problem shows the same, about what is wrong:
error: request failed because API URL was incorrectly formatted caused by: bad sentry url: not on URL root (https://***@sentry.tools.***/*)

This is what my sentry.properties for android looks like:

defaults.url=https://***@sentry.tools.***/*
defaults.org=***
defaults.project=***
auth.token=***

And it works for android

For iOS, I have exactly the same file, but it swears that the default.uri is incorrect and this is very strange

I’ll add one more detail, when I was logging into the cli, I had to add SENTRY_WIZARD_URL:

SENTRY_WIZARD_URL=https://***@sentry.tools.***/* yarn sentry-wizard -s -i reactNative

on the command line, and only in this case I could go through the login, otherwise I was faced with approximately the same error as now on iOS.
I tried to add this line when loading the debug symbols on iOS, but it did not solve the problem, as in the login step

@krystofwoldrich
Copy link
Member

@whyamsx Could you share how does your Upload Debug Symbols Sentry build phase look like? The reason why Android works likely is that it doesn't upload debug symbols by default but configuring Sentry Android Gradle Plugin is needed.

@kamilogorek Since this is related to the sentry-cli would you know what could be the issue?

Looks like source maps upload with the config but symbols do not.

Probably related to this command:

sentry-cli debug-files upload

@whyamsx
Copy link
Author

whyamsx commented May 24, 2023

@whyamsx Could you share how does your Upload Debug Symbols Sentry build phase look like?

[iOS] Upload Debug Symbols to Sentry (Build Phase):

export SENTRY_PROPERTIES=sentry.properties

SENTRY_CLI="../node_modules/@sentry/cli/bin/sentry-cli"
$NODE_BINARY $SENTRY_CLI upload-dif "$DWARF_DSYM_FOLDER_PATH"

@kamilogorek
Copy link
Contributor

not on URL root

This URL is incorrect. We do not support Sentry being put under non-root path.
See: getsentry/sentry-cli#1612

As for why it worked for Android, my guess is that it was just never picked up properly 👀

@krystofwoldrich
Copy link
Member

@kamilogorek Thanks for the details.

@whyamsx Were you able to solve this?

@whyamsx
Copy link
Author

whyamsx commented Jun 2, 2023

Hello, thanks!

I realized my main mistake, it was that I integrated Sentry using sentry-wizard and used the SENTRY_WIZARD_URL variable, in which I added my DSN, for some reason it worked for Android, but for iOS I tried to use the domain that we use for hosting Sentry locally and logging in not to sentry-wizard but to sentry-cli, specifying our domain in the url, and this solved all my problems.

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

No branches or pull requests

3 participants