question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

error: Found argument 'index.tsx' which wasn't expected, or isn't valid in this context

See original GitHub issue

OS:

  • Windows
  • MacOS
  • Linux

Platform:

  • iOS
  • Android

SDK:

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

SDK version: 4.12.0

react-native version: 0.66.5

Are you using Expo?

  • Yes
  • No

Are you using sentry.io or on-premise?

  • sentry.io (SaaS)
  • on-premise

I have following issue:

After installing sentry and run the below commands the app cannot build for iOS. It works fine on android though. in project.pbxproj file i have

Bundle React Native code and images:

shellScript = "export SENTRY_PROPERTIES=sentry.properties\nexport EXTRA_PACKAGER_ARGS=\"--sourcemap-output $DERIVED_FILE_DIR/main.jsbundle.map\"\nset -e\n\nexport NODE_BINARY=node\n../node_modules/@sentry/cli/bin/sentry-cli react-native xcode ../node_modules/react-native/scripts/react-native-xcode.sh index.tsx\n\n/bin/sh ../node_modules/@sentry/react-native/scripts/collect-modules.sh\n";

Upload Debug Symbols to Sentry:

export SENTRY_PROPERTIES=sentry.properties\n../node_modules/@sentry/cli/bin/sentry-cli upload-dsym

Steps to reproduce:

  • yarn add @sentry/react-native
  • yarn sentry-wizard -i reactNative -p ios android
  • cd ios && pod install
  • Build the app using Xcode

Actual result:

error: Found argument 'index.tsx' which wasn't expected, or isn't valid in this context

USAGE:
    sentry-cli react-native xcode [OPTIONS] [BUILD_SCRIPT] [-- <ARGS>...]

For more information try --help

Expected result:

Should be able to build successfully.

Issue Analytics

  • State:closed
  • Created 9 months ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
duttasuraj93commented, Dec 20, 2022

Finally found a solution. Remove the index.tsx from the original script in the question as mentioned by @krystofwoldrich and add export ENTRY_FILE=index.tsx to the script. That solves the issue.

So, here is how the script would look like

shellScript = "export SENTRY_PROPERTIES=sentry.properties\nexport EXTRA_PACKAGER_ARGS=\"--sourcemap-output $DERIVED_FILE_DIR/main.jsbundle.map\"\nset -e\n\nexport ENTRY_FILE=index.tsx\nexport NODE_BINARY=node\n../node_modules/@sentry/cli/bin/sentry-cli react-native xcode ../node_modules/react-native/scripts/react-native-xcode.sh \n\n/bin/sh ../node_modules/@sentry/react-native/scripts/collect-modules.sh\n";

Another solution that i found, but NOT recommended is, changing the file node_modules/react-native/scripts/react-native-xcode.sh:74 replace ENTRY_FILE=${1:-index.js} with ENTRY_FILE=${1:-index.tsx}

Hope this resolves the issue if anyone else if facing it

1reaction
duttasuraj93commented, Dec 17, 2022

will give it a try when i get to work on monday

just to clarify, you want me to change it to this

shellScript = "export SENTRY_PROPERTIES=sentry.properties\nexport EXTRA_PACKAGER_ARGS=\"--sourcemap-output $DERIVED_FILE_DIR/main.jsbundle.map\"\nset -e\n\nexport NODE_BINARY=node\n../node_modules/@sentry/cli/bin/sentry-cli react-native xcode ../node_modules/react-native/scripts/react-native-xcode.sh \n\n/bin/sh ../node_modules/@sentry/react-native/scripts/collect-modules.sh\n";
Read more comments on GitHub >

github_iconTop Results From Across the Web

Getting error: Found argument '--webdriver-port' which wasn't ...
Issue is resolved as there is problem "In the current revision (after 0.9.0), the argument webdriver-port was renamed to port.
Read more >
webdriver-port' which wasn't expected, or isn't valid in this ...
When I run my selenium code, I get this error error: Found argument '--webdriver-port' which wasn't expected, or isn't valid in this context...
Read more >
Documentation - Everyday Types - TypeScript
In this chapter, we'll cover some of the most common types of values you'll find in JavaScript code, and explain the corresponding ways...
Read more >
Changelog - Cypress Documentation
The Cypress App will no longer crash when passed a --spec: {} from the CLI and instead error when passed an invalid object...
Read more >
VS Code API | Visual Studio Code Extension API
However, when invoking an editor command not all argument types are supported. ... export function activate(context: vscode.ExtensionContext) { let api ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found