Sentry-react-native: Getting "No platform selected" from sentry-wizard

Created on 10 Mar 2021  Â·  33Comments  Â·  Source: getsentry/sentry-react-native

Environment

How do you use Sentry?
Sentry SaaS

Which SDK and version?
@sentry/react-native: 2.2.2
react-native: 0.63.3

Steps to Reproduce

  1. Follow the installation guide and running
    npx @sentry/wizard -i reactNative -p android
  2. Getting this:
    `✅ Patched build.gradle file.
    Error: No platform selected
    at ReactNative.MobileProject.getPlatforms (/Applications/MAMP/htdocs/shkolo/shkolo-mobileapp/node_modules/@sentry/wizard/dist/lib/Steps/Integrations/MobileProject.js:65:19)
    at ReactNative._patchJs (/Applications/MAMP/htdocs/shkolo/shkolo-mobileapp/node_modules/@sentry/wizard/dist/lib/Steps/Integrations/ReactNative.js:224:14)
    at /Applications/MAMP/htdocs/shkolo/shkolo-mobileapp/node_modules/@sentry/wizard/dist/lib/Helper/File.js:28:45
    at processTicksAndRejections (node:internal/process/task_queues:94:5)

🎉 Successfully set up Sentry for your project 🎉`

  1. But android/sentry.properties is not generated
    and after that when I try to build the android app I get:
    `

Task :app:bundleReleaseJsAndAssets_SentryUpload_89 FAILED
error: An organization slug is required (provide with --org)
`

Expected Result

The Sentry setup should be successful and the app should be build successfully

Actual Result

I get both errors described in the steps.

Type Bug

Most helpful comment

I am seeing the exact same issue. Project previously had v2.0.0 setup in November and everything worked well. After updating via yarn to 2.3.0 I started getting compile issues in Android. Wizard --uninstall would fail with ENAMETOOLONG when trying to revert the iOS project, so I just reverted my initial sentry install commit, cleaned build folders, ran yarn, etc. Then when trying to re-add sentry using the current version and wizard I get the same error as the OP.

Of note, I get asked to select the platform 5 times during the wizard. IOS and Android are selected each time. Using -p ios android throws the same error, but doesn't ever ask for the platforms.

How do you use Sentry?
Self-hosted Sentry

Which SDK and version?
@sentry/react-native: 2.3.0
react-native: 0.63.4

```
npx @sentry/wizard -i reactNative --url 'https://
'Running Sentry Wizard...version: 1.2.2 | sentry-cli version: 1.63.1
Sentry Wizard will help you to configure your project

Thank you for using Sentry :)
? Select the platforms you like to set up: (Press to select, to toggle all, to invert selection)iOS, Android
? Select the platforms you like to set up: (Press to select,
to toggle all, to invert selection)iOS, Android

Please open https:///account/settings/wizard/vmxmf043k3rrpby43za1mcjlu9anawpwqq9m26dkuwuape6lfvz2cy4xdxwim773/in your browser (if it's not open already)

? Select the platforms you like to set up: (Press to select, to toggle all, to invert selection)iOS, Android

? Please select your project in Sentry:
? Select the platforms you like to set up: (Press to select,
to toggle all, to invert selection)iOS, Android
? Select the platforms you like to set up: (Press to select,
to toggle all, to invert selection)iOS, Android
✅ Patched build.gradle file.
Error: No platform selected    at ReactNative.MobileProject.getPlatforms (/Users/act/.npm/_npx/45638/lib/node_modules/@sentry/wizard/dist/lib/Steps/Integrations/MobileProject.js:65:19)    at ReactNative._patchJs (/Users/act/.npm/_npx/45638/lib/node_modules/@sentry/wizard/dist/lib/Steps/Integrations/ReactNative.js:224:14)    at /Users/act/.npm/_npx/45638/lib/node_modules/@sentry/wizard/dist/lib/Helper/File.js:28:45    at processTicksAndRejections (internal/process/task_queues.js:93:5)
✅ Patched build script in Xcode project.
Error: No platform selected    at ReactNative.MobileProject.getPlatforms (/Users/act/.npm/_npx/45638/lib/node_modules/@sentry/wizard/dist/lib/Steps/Integrations/MobileProject.js:65:19)    at ReactNative._patchJs (/Users/act/.npm/_npx/45638/lib/node_modules/@sentry/wizard/dist/lib/Steps/Integrations/ReactNative.js:224:14)    at /Users/act/.npm/_npx/45638/lib/node_modules/@sentry/wizard/dist/lib/Helper/File.js:28:45    at processTicksAndRejections (internal/process/task_queues.js:93:5)
Successfully set up Sentry for your project

All 33 comments

Thanks for reporting, we are taking a look

I am seeing the exact same issue. Project previously had v2.0.0 setup in November and everything worked well. After updating via yarn to 2.3.0 I started getting compile issues in Android. Wizard --uninstall would fail with ENAMETOOLONG when trying to revert the iOS project, so I just reverted my initial sentry install commit, cleaned build folders, ran yarn, etc. Then when trying to re-add sentry using the current version and wizard I get the same error as the OP.

Of note, I get asked to select the platform 5 times during the wizard. IOS and Android are selected each time. Using -p ios android throws the same error, but doesn't ever ask for the platforms.

How do you use Sentry?
Self-hosted Sentry

Which SDK and version?
@sentry/react-native: 2.3.0
react-native: 0.63.4

```
npx @sentry/wizard -i reactNative --url 'https://
'Running Sentry Wizard...version: 1.2.2 | sentry-cli version: 1.63.1
Sentry Wizard will help you to configure your project

Thank you for using Sentry :)
? Select the platforms you like to set up: (Press to select,
to toggle all, to invert selection)iOS, Android
? Select the platforms you like to set up: (Press to select,
to toggle all, to invert selection)iOS, Android

Please open https:///account/settings/wizard/vmxmf043k3rrpby43za1mcjlu9anawpwqq9m26dkuwuape6lfvz2cy4xdxwim773/in your browser (if it's not open already)

? Select the platforms you like to set up: (Press to select, to toggle all, to invert selection)iOS, Android

? Please select your project in Sentry:
? Select the platforms you like to set up: (Press to select,
to toggle all, to invert selection)iOS, Android
? Select the platforms you like to set up: (Press to select,
to toggle all, to invert selection)iOS, Android
✅ Patched build.gradle file.
Error: No platform selected    at ReactNative.MobileProject.getPlatforms (/Users/act/.npm/_npx/45638/lib/node_modules/@sentry/wizard/dist/lib/Steps/Integrations/MobileProject.js:65:19)    at ReactNative._patchJs (/Users/act/.npm/_npx/45638/lib/node_modules/@sentry/wizard/dist/lib/Steps/Integrations/ReactNative.js:224:14)    at /Users/act/.npm/_npx/45638/lib/node_modules/@sentry/wizard/dist/lib/Helper/File.js:28:45    at processTicksAndRejections (internal/process/task_queues.js:93:5)
✅ Patched build script in Xcode project.
Error: No platform selected    at ReactNative.MobileProject.getPlatforms (/Users/act/.npm/_npx/45638/lib/node_modules/@sentry/wizard/dist/lib/Steps/Integrations/MobileProject.js:65:19)    at ReactNative._patchJs (/Users/act/.npm/_npx/45638/lib/node_modules/@sentry/wizard/dist/lib/Steps/Integrations/ReactNative.js:224:14)    at /Users/act/.npm/_npx/45638/lib/node_modules/@sentry/wizard/dist/lib/Helper/File.js:28:45    at processTicksAndRejections (internal/process/task_queues.js:93:5)
Successfully set up Sentry for your project

+1

Facing the same issue,

@sentry/react-native: 2.4.0
react-native: 0.63.4

This would likely be a reason source maps are not being uploaded right?

The same issue

Same here.
UPDATE:
I ran yarn add @sentry/
[email protected] and reran the wizard. This error is gone.

Same here

same here

Had the same issue.
Ran npm i --save-dev @sentry/[email protected] as @hanselsen said.
But after that I got:

✅ Patched build.gradle file.
✅ Patched App.js file.
✅ Added sentry.properties file to android
Successfully set up android for react-native
TypeError [ERR_INVALID_ARG_TYPE]: The "data" argument must be of type string or an instance of Buffer, TypedArray, or DataView. Received undefined
    at Object.writeFileSync (node:fs:1507:5)
    at {projectdir}/node_modules/@sentry/wizard/dist/lib/Helper/File.js:23:20
    at processTicksAndRejections (node:internal/process/task_queues:94:5)

🎉  Successfully set up Sentry for your project 🎉

And "An organization slug is required" error on building project.

Then I just copied sentry.properties from android to ios directory and everything works fine.

Indeed as @victoriaSh said, I too am stuck on this new TypeError.
As both version 1.2.3 and 1.1.4 are crashing, we should use 1.2.3 and try to fix the "No platform selected" issue.
Is there anyone from Sentry that can confirm that this is under investigation?

I decided not to be lazy and used the manual configuration. It is now working for me. Hopefully other people will get to enjoy the wizard.

I'm on React Native 0.59
@sentry/react-native: "^2.4.1"
I also get this even though it said "Successfully set up Sentry for your project":

Error: No platform selected
    at ReactNative.MobileProject.getPlatforms (/Users/pure2maestro/code/ember-app/node_modules/@sentry/wizard/dist/lib/Steps/Integrations/MobileProject.js:65:19)
    at ReactNative._patchJs (/Users/pure2maestro/code/ember-app/node_modules/@sentry/wizard/dist/lib/Steps/Integrations/ReactNative.js:224:14)
    at /Users/pure2maestro/code/ember-app/node_modules/@sentry/wizard/dist/lib/Helper/File.js:28:45
    at process._tickCallback (internal/process/next_tick.js:68:7)
{
    "message": "Expected \"/*\", \"//\", or \"{\" but \"u\" found.",
    "expected": [
        {
            "type": "literal",
            "text": "//",
            "ignoreCase": false
        },
        {
            "type": "literal",
            "text": "/*",
            "ignoreCase": false
        },
        {
            "type": "literal",
            "text": "{",
            "ignoreCase": false
        }
    ],
    "found": "u",
    "location": {
        "start": {
            "offset": 0,
            "line": 1,
            "column": 1
        },
        "end": {
            "offset": 1,
            "line": 1,
            "column": 2
        }
    },
    "name": "SyntaxError"
}

I can't even "pod install" now. Throws this:

post_install do |installer|
  installer.pods_project.build_configurations.each do |config|
              if config.name == 'Staging'
                  config.build_settings['CONFIGURATION_TEMP_DIR'] = '$(PROJECT_TEMP_DIR)/Release$(EFFECTIVE_PLATFORM_NAME)'
                  config.build_settings['CONFIGURATION_BUILD_DIR'] = '$(BUILD_DIR)/Release$(EFFECTIVE_PLATFORM_NAME)'
              end
  end
  installer.pods_project.targets.each do |target|
          target.build_configurations.each do |config|
              if config.name == 'Staging'
                  config.build_settings['CONFIGURATION_TEMP_DIR'] = '$(PROJECT_TEMP_DIR)/Release$(EFFECTIVE_PLATFORM_NAME)'
                  config.build_settings['PODS_CONFIGURATION_BUILD_DIR'] = '${PODS_BUILD_DIR}/Release$(EFFECTIVE_PLATFORM_NAME)'
              end
          end
  end
end

Error

NoMethodError - undefined method `[]' for nil:NilClass
/Library/Ruby/Gems/2.6.0/gems/xcodeproj-1.17.1/lib/xcodeproj/project.rb:265:in `new_from_plist'
/Library/Ruby/Gems/2.6.0/gems/xcodeproj-1.17.1/lib/xcodeproj/project.rb:212:in `initialize_from_file'
/Library/Ruby/Gems/2.6.0/gems/xcodeproj-1.17.1/lib/xcodeproj/project.rb:112:in `open'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.9.3/lib/cocoapods/installer/analyzer.rb:1177:in `block (2 levels) in inspect_targets_to_integrate'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.9.3/lib/cocoapods/installer/analyzer.rb:1176:in `each'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.9.3/lib/cocoapods/installer/analyzer.rb:1176:in `block in inspect_targets_to_integrate'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.9.3/lib/cocoapods/user_interface.rb:64:in `section'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.9.3/lib/cocoapods/installer/analyzer.rb:1171:in `inspect_targets_to_integrate'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.9.3/lib/cocoapods/installer/analyzer.rb:106:in `analyze'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.9.3/lib/cocoapods/installer.rb:410:in `analyze'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.9.3/lib/cocoapods/installer.rb:235:in `block in resolve_dependencies'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.9.3/lib/cocoapods/user_interface.rb:64:in `section'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.9.3/lib/cocoapods/installer.rb:234:in `resolve_dependencies'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.9.3/lib/cocoapods/installer.rb:156:in `install!'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.9.3/lib/cocoapods/command/install.rb:52:in `run'
/Library/Ruby/Gems/2.6.0/gems/claide-1.0.3/lib/claide/command.rb:334:in `run'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.9.3/lib/cocoapods/command.rb:52:in `run'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.9.3/bin/pod:55:in `<top (required)>'
/usr/local/bin/pod:23:in `load'
/usr/local/bin/pod:23:in `<main>'

Same issue here.

I can confirm that the PR 105 fixes the issue. Thanks!

@hanselsen how can i get the version with that PR merged ?

@KinanKazmi You can just update to the latest version.

It says last update was 6 days ago. I just tried it last hour.

On Mon, May 10, 2021, 11:16 AM Jenn Mueng @.*> wrote:

@KinanKazmi https://github.com/KinanKazmi You can just update to the
latest version.

—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
https://github.com/getsentry/sentry-react-native/issues/1386#issuecomment-836232371,
or unsubscribe
https://github.com/notifications/unsubscribe-auth/AE2HKU3YV3EVDRCGTUM7FL3TM523FANCNFSM4Y5TFVDQ
.

@KinanKazmi Did you actually update? This issue does not exist anymore.

@jennmueng i just installed it an hour ago and got that error.
Didn't have to update. It was a fresh install in my new project.

It says last update was 6 days ago. I just tried it last hour.
…

If it still occurs please provide a reproduction and the version in your lockfile/node_modules

@KinanKazmi try yarn add @sentry/[email protected]

Screenshot 2021-05-10 at 11 40 01 AM

@hanselsen some of my packages dont exist on yarn so that doesn't work at all.

@jennmueng can you confirm if i need to provide more info for this ?

@jennmueng just tried it for a brand new project. Still fails.

kinan@Kinans-MacBook-Pro react % npx react-native init testForSentry Need to install the following packages: react-native Ok to proceed? (y) y npm WARN deprecated [email protected]: Please see https://github.com/lydell/urix#deprecated npm WARN deprecated [email protected]: https://github.com/lydell/resolve-url#deprecated npm WARN deprecated [email protected]: support for ECMAScript is superseded byuglify-js` as of v3.13.0

           ######                ######               
         ###     ####        ####     ###             
        ##          ###    ###          ##            
        ##             ####             ##            
        ##             ####             ##            
        ##           ##    ##           ##            
        ##         ###      ###         ##            
         ##  ########################  ##             
      ######    ###            ###    ######          
  ###     ##    ##              ##    ##     ###

### ## ### #### ### ## ###
## #### ######## #### ##
## ### ########## ### ##
## #### ######## #### ##
### ## ### #### ### ## ###
### ## ## ## ## ###
###### ### ### ######
## ######################## ##
## ### ### ##
## ## ## ##
## #### ##
## #### ##
## ### ### ##
### #### #### ###
###### ######

              Welcome to React Native!                
             Learn once, write anywhere

✔ Downloading template
✔ Copying template
✔ Processing template
✖ Installing CocoaPods dependencies (this may take a few minutes)
✖ Installing CocoaPods dependencies (this may take a few minutes)
error Error: Failed to install CocoaPods dependencies for iOS project, which is required by this template.
Please try again manually: "cd ./testForSentry/ios && pod install".
CocoaPods documentation: https://cocoapods.org/
kinan@Kinans-MacBook-Pro react % ls
AvazaExpenses okta-react-native-app-auth-example testForSentry
AvazaExpenses.zip package-lock.json testProj
AvazaTSMobile scroller toDoList
node_modules taskassigner
kinan@Kinans-MacBook-Pro react % cd testForSentry
kinan@Kinans-MacBook-Pro testForSentry % clear

kinan@Kinans-MacBook-Pro testForSentry % npm install --save @sentry/react-native

added 107 packages, changed 3 packages, and audited 1072 packages in 9s

72 packages are looking for funding
run npm fund for details

4 low severity vulnerabilities

Some issues need review, and may require choosing
a different dependency.

Run npm audit for details.
kinan@Kinans-MacBook-Pro testForSentry % npx @sentry/wizard -i reactNative -p ios android
Running Sentry Wizard...
version: 1.2.7 | sentry-cli version: 1.64.1
Sentry Wizard will help you to configure your project
Thank you for using Sentry :)

Please open
https://sentry.io/account/settings/wizard/npe1p02nxyg14j26ltc2bgpls5onnmhwip0smpmjwayan4v3zenxiqlbdfz9pzs2/
in your browser (if it's not open already)

? Please select your project in Sentry: Avaza / avaza-expenses-apps
✅ Patched build.gradle file.
Error: No platform selected
at ReactNative.MobileProject.getPlatforms (/Users/kinan/react/testForSentry/node_modules/@sentry/wizard/dist/lib/Steps/Integrations/MobileProject.js:65:19)
at ReactNative._patchJs (/Users/kinan/react/testForSentry/node_modules/@sentry/wizard/dist/lib/Steps/Integrations/ReactNative.js:224:14)
at /Users/kinan/react/testForSentry/node_modules/@sentry/wizard/dist/lib/Helper/File.js:28:45
at processTicksAndRejections (internal/process/task_queues.js:97:5)
✅ Patched build script in Xcode project.
Error: No platform selected
at ReactNative.MobileProject.getPlatforms (/Users/kinan/react/testForSentry/node_modules/@sentry/wizard/dist/lib/Steps/Integrations/MobileProject.js:65:19)
at ReactNative._patchJs (/Users/kinan/react/testForSentry/node_modules/@sentry/wizard/dist/lib/Steps/Integrations/ReactNative.js:224:14)
at /Users/kinan/react/testForSentry/node_modules/@sentry/wizard/dist/lib/Helper/File.js:28:45
at processTicksAndRejections (internal/process/task_queues.js:97:5)

🎉 Successfully set up Sentry for your project 🎉
kinan@Kinans-MacBook-Pro testForSentry %
`

@KinanKazmi
npm remove --save @sentry/wizard
npm install --save @sentry/[email protected]

@hanselsen same, even for a brand new project

@KinanKazmi if it says that it patched the files successfully, you should be good. I will check why the error still throws if I can reproduce your issue.

@jennmueng it actually broke my xcode project. The xCode cant even open the project. Luckily i had Git backup so i restored it. Then pod install caused more issues. Updated cocapods and still no difference.
Note: I'm using the latest Mac OS and Xcode.

@KinanKazmi Can you provide a reproduction repo? Looks like some edge case as it’s solved for others.

@jennmueng its happening with my new project too.

npx react-native init sentryTest
cd sentryTest
npm install --save @sentry/react-native
npx @sentry/wizard -i reactNative -p ios android

Result is the same screenshot i posted above.

@KinanKazmi Try [email protected]

@jennmueng sorry i forgot to respond here, yes that worked. Thanks a bunch!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

ThomasLarge picture ThomasLarge  Â·  3Comments

deathemperor picture deathemperor  Â·  3Comments

kriptonhaz picture kriptonhaz  Â·  3Comments

dht picture dht  Â·  3Comments

brainbicycle picture brainbicycle  Â·  3Comments