sentry-react-native icon indicating copy to clipboard operation
sentry-react-native copied to clipboard

Getting "No platform selected" from sentry-wizard

Open alexstoyanov opened this issue 5 years ago • 33 comments

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 🎉 3. 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.

alexstoyanov avatar Mar 10 '21 09:03 alexstoyanov

Thanks for reporting, we are taking a look

HazAT avatar Mar 10 '21 13:03 HazAT

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://<redacted>
'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 <space> to select, <a> to toggle all, <i> to invert selection)iOS, Android
? Select the platforms you like to set up: (Press <space> to select, <a> to toggle all, <i> to invert selection)iOS, Android

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

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

? Please select your project in Sentry: <redacted>
? Select the platforms you like to set up: (Press <space> to select, <a> to toggle all, <i> to invert selection)iOS, Android
? Select the platforms you like to set up: (Press <space> to select, <a> to toggle all, <i> 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

coltonmccormack avatar Mar 17 '21 18:03 coltonmccormack

+1

the-prime-thanatos avatar Mar 24 '21 12:03 the-prime-thanatos

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?

renatomserra avatar Mar 25 '21 19:03 renatomserra

The same issue

it-hienvv avatar Mar 29 '21 06:03 it-hienvv

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

hanselsen avatar Mar 29 '21 11:03 hanselsen

Same here

NhanTranThanh avatar Mar 30 '21 03:03 NhanTranThanh

same here

Zakyyy avatar Apr 08 '21 12:04 Zakyyy

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.

victoriaSh avatar Apr 12 '21 00:04 victoriaSh

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?

hanselsen avatar Apr 12 '21 12:04 hanselsen

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.

hanselsen avatar Apr 12 '21 14:04 hanselsen

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>'

bruscantini avatar Apr 19 '21 15:04 bruscantini

Same issue here.

KinanKazmi avatar May 10 '21 05:05 KinanKazmi

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

hanselsen avatar May 10 '21 06:05 hanselsen

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

KinanKazmi avatar May 10 '21 06:05 KinanKazmi

@KinanKazmi You can just update to the latest version.

jennmueng avatar May 10 '21 06:05 jennmueng

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 avatar May 10 '21 06:05 KinanKazmi

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

jennmueng avatar May 10 '21 06:05 jennmueng

@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.

KinanKazmi avatar May 10 '21 06:05 KinanKazmi

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

jennmueng avatar May 10 '21 06:05 jennmueng