getsentry / sentry-react-native

Official Sentry SDK for React Native
https://sentry.io
MIT License
1.56k stars 332 forks source link

The system cannot find the file specified. (os error 2) while assembling Android release #2442

Closed vorlovsky closed 2 years ago

vorlovsky commented 2 years ago

OS: Windows

Platform: Android

SDK: @sentry/react-native (>= 1.0.0)

SDK version: 4.2.4

react-native version: 0.60.3

Are you using Expo? No

Are you using sentry.io or on-premise? sentry.io (SaaS)

Configuration:

Nevermind as the issue occurs only upon building release version


I have following issue:

My app to fails to assemble an Android build. The only information in the console is "The system cannot find the file specified. (os error 2) " without any clues what file it is related to. I'm using @sentry/react-native 4.2.4 (also tried @sentry/cli both basic 1.79.X and upgraded to 2.5.2). Can you please advice what to do to fix it?

Steps to reproduce:

Actual result:

I've got the following debug output: 22:24:16.862 [INFO] [org.gradle.internal.execution.steps.ResolveCachingStateStep] Caching disabled for task ':app:bundleReleaseJsAndAssets' because: Build cache is disabled 22:24:16.863 [DEBUG] [org.gradle.internal.execution.steps.SkipUpToDateStep] Determining if task ':app:bundleReleaseJsAndAssets' is up-to-date 22:24:16.863 [INFO] [org.gradle.internal.execution.steps.SkipUpToDateStep] Skipping task ':app:bundleReleaseJsAndAssets' as it is up-to-date. 22:24:16.863 [DEBUG] [org.gradle.api.internal.tasks.execution.ResolveTaskExecutionModeExecuter] Removed task artifact state for {} from context. 22:24:16.863 [DEBUG] [org.gradle.internal.operations.DefaultBuildOperationExecutor] Completing Build operation 'Task :app:bundleReleaseJsAndAssets' 22:24:16.863 [DEBUG] [org.gradle.internal.operations.DefaultBuildOperationExecutor] Build operation 'Task :app:bundleReleaseJsAndAssets' completed 22:24:16.863 [INFO] [org.gradle.execution.plan.DefaultPlanExecutor] :app:bundleReleaseJsAndAssets (Thread[Execution worker for ':' Thread 2,5,main]) completed. Took 14.065 secs. 22:24:16.863 [DEBUG] [org.gradle.internal.resources.AbstractTrackedResourceLock] Execution worker for ':' Thread 2: released lock on : 22:24:16.863 [DEBUG] [org.gradle.internal.work.DefaultWorkerLeaseService] Worker lease root.1.52 completed (1 worker(s) in use) 22:24:16.863 [DEBUG] [org.gradle.internal.resources.AbstractTrackedResourceLock] Execution worker for ':' Thread 2: released lock on root.1.52 22:24:16.864 [DEBUG] [org.gradle.internal.resources.AbstractTrackedResourceLock] Execution worker for ':' Thread 2: acquired lock on : 22:24:16.864 [DEBUG] [org.gradle.internal.work.DefaultWorkerLeaseService] Worker lease root.1.52 started (1 worker(s) in use). 22:24:16.864 [DEBUG] [org.gradle.internal.resources.AbstractTrackedResourceLock] Execution worker for ':' Thread 2: acquired lock on root.1.52 22:24:16.864 [INFO] [org.gradle.execution.plan.DefaultPlanExecutor] :app:bundleReleaseJsAndAssets_SentryUpload_com.mixoft.spicapp.by@0.0.8+8_8 (Thread[Execution worker for ':' Thread 2,5,main]) started. 22:24:16.864 [LIFECYCLE] [class org.gradle.internal.buildevents.TaskExecutionLogger] 22:24:16.864 [LIFECYCLE] [class org.gradle.internal.buildevents.TaskExecutionLogger] > Task :app:bundleReleaseJsAndAssets_SentryUpload_com.mixoft.spicapp.by@0.0.8+8_8 FAILED 22:24:16.864 [DEBUG] [org.gradle.internal.operations.DefaultBuildOperationExecutor] Build operation 'Task :app:bundleReleaseJsAndAssets_SentryUpload_com.mixoft.spicapp.by@0.0.8+8_8' started 22:24:16.864 [DEBUG] [org.gradle.api.internal.tasks.execution.ResolveTaskExecutionModeExecuter] Putting task artifact state for task ':app:bundleReleaseJsAndAssets_SentryUpload_com.spicapp.by@0.0.8+8_8' into context took 0.0 secs. 22:24:16.864 [INFO] [org.gradle.internal.execution.steps.ResolveCachingStateStep] Caching disabled for task ':app:bundleReleaseJsAndAssets_SentryUpload_com.mixoft.spicapp.by@0.0.8+8_8' because: Build cache is disabled 22:24:16.864 [DEBUG] [org.gradle.internal.execution.steps.SkipUpToDateStep] Determining if task ':app:bundleReleaseJsAndAssets_SentryUpload_com.mixoft.spicapp.by@0.0.8+8_8' is up-to-date 22:24:16.865 [INFO] [org.gradle.internal.execution.steps.SkipUpToDateStep] Task ':app:bundleReleaseJsAndAssets_SentryUpload_com.mixoft.spicapp.by@0.0.8+8_8' is not up-to-date because: Task has not declared any outputs despite executing actions. 22:24:16.865 [DEBUG] [org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter] Executing actions for task ':app:bundleReleaseJsAndAssets_SentryUpload_com.mixoft.spicapp.by@0.0.8+8_8'. 22:24:16.867 [DEBUG] [org.gradle.internal.operations.DefaultBuildOperationExecutor] Build operation 'Execute exec for :app:bundleReleaseJsAndAssets_SentryUpload_com.mixoft.spicapp.by@0.0.8+8_8' started 22:24:16.867 [INFO] [org.gradle.process.internal.DefaultExecHandle] Starting process 'command 'cmd''. Working directory: D:\Work\SPIC\mobile Command: cmd /c node D:\Work\SPIC\mobile\node_modules\@sentry\cli\bin\sentry-cli react-native gradle --bundle D:\Work\SPIC\mobile\android\app\build\generated\assets\react\release\index.android.bundle --sourcemap D:\Work\SPIC\mobile\android\app\build\intermediates\sourcemaps\release\index.android.bundle.packager.map --release com.mixoft.spicapp.by@0.0.8+8 --dist 8 22:24:16.868 [DEBUG] [org.gradle.process.internal.DefaultExecHandle] Environment for process 'command 'cmd'': {npm_package_dependencies_react_native_simple_radio_button=^2.7.3, npm_config_ignore_scripts=, npm_config_version_git_tag=true, npm_package_dependencies_react_native_signature_capture=^0.4.12, npm_package_dependencies_react_native_svg=^9.3.3, NVM_SYMLINK=C:\Program Files\nodejs, npm_lifecycle_script=SET ENVFILE=src/config/.env.prod.bel && cd android && gradlew assembleRelease, npm_package_dependencies_redux=^4.0.1, SESSIONNAME=Console, ALLUSERSPROFILE=C:\ProgramData, npm_package_dependencies_react_native_bcrypt=^2.4.0, INTEL_DEV_REDIST=C:\Program Files (x86)\Common Files\Intel\Shared Libraries\, ANDROID_HOME=D:\Work\SDK\android\sdk, npm_package_devDependencies_jest=^24.8.0, SystemDrive=C:, npm_package_dependencies_react_native=0.60.3, npm_package_devDependencies__babel_plugin_transform_for_of=^7.18.1, INIT_CWD=D:\Work\SPIC\mobile, DIRNAME=D:\Work\SPIC\mobile\android\, npm_package_scripts_start=SET ENVFILE=src/config/.env.bel && react-native start, USERNAME=LJ, IOSUNITYBUILDER_PATH=D:\Work\Unity\iOS Project Builder for Unity, CMD_LINE_ARGS=assembleRelease --debug, ProgramFiles(x86)=C:\Program Files (x86), FPS_BROWSER_USER_PROFILE_STRING=Default, DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m", PATHEXT=.COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC;.PY;.PYW, DriverData=C:\Windows\System32\Drivers\DriverData, NODE=C:\Program Files\nodejs\node.exe, npm_package_devDependencies_postinstall_postinstall=^2.1.0, npm_node_execpath=C:\Program Files\nodejs\node.exe, npm_package_scripts_postinstall=patch-package, HOMEPATH=\Users\LJ, PROCESSOR_IDENTIFIER=Intel64 Family 6 Model 30 Stepping 5, GenuineIntel, ProgramFiles=C:\Program Files, PUBLIC=C:\Users\Public, windir=C:\WINDOWS, npm_package_jest_preset=react-native, npm_package_devDependencies_eslint=^6.1.0, _SKIP=2, npm_package_private=true, npm_package_devDependencies_babel_jest=^24.8.0, npm_config_init_license=MIT, npm_config_version_git_sign=, FPS_BROWSER_APP_PROFILE_STRING=Internet Explorer, npm_package_dependencies_url_parse=^1.4.7, JAVA_HOME=C:\Program Files\Java\jdk-11.0.15, PROMPT=$P$G, npm_config_strict_ssl=true, npm_package_dependencies__react_native_community_async_storage=^1.12.1, ANT_HOME=D:\tools\apache-ant-1.10.12, asl.log=Destination=file, OneDrive=C:\Users\LJ\OneDrive, APPDATA=C:\Users\LJ\AppData\Roaming, npm_config_version_git_message=v%s, npm_package_dependencies_react_redux=^5.1.1, JAVA_EXE=C:\Program Files\Java\jdk-11.0.15/bin/java.exe, ChocolateyInstall=C:\ProgramData\chocolatey, npm_package_scripts_apk_bel=SET ENVFILE=src/config/.env.prod.bel && cd android && gradlew assembleRelease, npm_package_devDependencies__react_native_community_eslint_config=^0.0.5, Path=C:\Users\LJ\AppData\Local\Temp\yarn--1661973785896-0.32183801634697407;D:\Work\SPIC\mobile\node_modules\.bin;C:\Users\LJ\AppData\Local\Yarn\Data\link\node_modules\.bin;C:\Users\LJ\AppData\Local\Yarn\bin;C:\Program Files\libexec\lib\node_modules\npm\bin\node-gyp-bin;C:\Program Files\lib\node_modules\npm\bin\node-gyp-bin;C:\Program Files\nodejs\node_modules\npm\bin\node-gyp-bin;C:\Program Files\Common Files\Oracle\Java\javapath;C:\Program Files (x86)\Common Files\Oracle\Java\javapath;C:\Program Files\ImageMagick-7.0.11-Q16-HDRI;C:\Python39\Scripts\;C:\Python39\;C:\Program Files (x86)\Common Files\Intel\Shared Libraries\redist\intel64\compiler;D:/tools/ffmpeg/bin;C:\Python27\;C:\Python27\Scripts;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Windows\System32\OpenSSH\;C:\Program Files (x86)\ATI Technologies\ATI.ACE\Core-Static;C:\ProgramData\chocolatey\bin;C:\Users\LJ\AppData\Local\Microsoft\WindowsApps;C:\Users\LJ\AppData\Roaming\npm;D:\tools;C:\Program Files\TortoiseSVN\bin;D:\Work\SDK\android\sdk\platform-tools;C:\Program Files\dotnet\;C:\Program Files\Microsoft SQL Server\130\Tools\Binn\;C:\Program Files\Microsoft SQL Server\Client SDK\ODBC\170\Tools\Binn\;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\WINDOWS\System32\OpenSSH\;D:\tools\OpenSSL-Win64\bin\;C:\Program Files\Microchip\xc8\v2.31\bin;C:\Program Files\PuTTY\;C:\Users\LJ\.platformio\penv\Scripts\;C:\Program Files\SmartGit\git\bin;D:\tools\apktool;C:\Program Files (x86)\Microsoft SQL Server\100\Tools\Binn\;C:\Program Files\Microsoft SQL Server\100\Tools\Binn\;C:\Program Files\Microsoft SQL Server\100\DTS\Binn\;C:\Program Files (x86)\Microsoft SQL Server\100\Tools\Binn\VSShell\Common7\IDE\;C:\Program Files (x86)\Microsoft SQL Server\100\DTS\Binn\;C:\Program Files\Docker\Docker\resources\bin;C:\ProgramData\DockerDesktop\version-bin;C:\Users\LJ\AppData\Roaming\nvm;C:\Program Files\nodejs;D:\tools\scrcpy;C:\Program Files\Java\jdk-11.0.15\bin;D:\tools\scripts;D:\tools\apache-ant-1.10.12\bin;C:\Program Files\GitHub CLI\;C:\Program Files\Git\cmd;C:\Users\LJ\scoop\shims;C:\Users\LJ\AppData\Local\python2\scripts;C:\Users\LJ\AppData\Local\python2;C:\Users\LJ\AppData\Local\Microsoft\WindowsApps;C:\Program Files\Microsoft VS Code\bin;C:\Users\LJ\AppData\Local\Microsoft\WindowsApps;C:\Users\LJ\AppData\Roaming\nvm;C:\Program Files\nodejs;;C:\Program Files (x86)\mitmproxy\bin, npm_config_argv={"remain":[],"cooked":["run","apk-bel"],"original":["run","apk-bel","--debug"]}, npm_package_dependencies_react_native_masked_text=^1.13.0, COMPUTERNAME=DESKTOP-9713OUE, npm_package_dependencies_uuid=^3.3.2, npm_package_devDependencies__sentry_cli=^2.5.2, npm_package_dependencies_date_fns=^2.28.0, npm_package_scripts_app_bel=SET ENVFILE=src/config/.env.bel && react-native run-android --appId com.mixoft.spicapp.by.dev -- --reset-cache, npm_package_devDependencies_jetifier=^2.0.0, npm_config_user_agent=yarn/1.22.18 npm/? node/v16.14.2 win32 x64, npm_package_dependencies__sentry_react_native=^4.2.4, ComSpec=C:\WINDOWS\system32\cmd.exe, npm_package_dependencies_styled_components=^4.1.1, npm_package_name=SPIC, npm_config_ignore_optional=, APP_BASE_NAME=gradlew, npm_package_devDependencies_patch_package=^6.4.7, =D:=D:\Work\SPIC\mobile\android, npm_config_registry=https://registry.yarnpkg.com, HOMEDRIVE=C:, npm_config_email=vyacheslav_orlovsky@hotmail.com, npm_package_dependencies_react_native_video=^5.0.1, NUMBER_OF_PROCESSORS=4, npm_package_scripts_reset_cache=watchman watch-del-all && rm -rf $TMPDIR/react-native-packager-cache-* rm -rf $TMPDIR/metro-bundler-cache-* && rm -rf node_modules/ && npm cache verify && yarn, YARN_WRAP_OUTPUT=false, npm_package_dependencies_react_native_fs=^2.16.6, npm_package_dependencies_react_native_svg_charts=^5.2.0, USERDOMAIN_ROAMINGPROFILE=DESKTOP-9713OUE, PROCESSOR_LEVEL=6, npm_package_dependencies_react_native_check_box=^2.1.6, npm_package_dependencies_react_native_webview=^6.11.1, PROCESSOR_ARCHITECTURE=AMD64, MIC_LD_LIBRARY_PATH=C:\Program Files (x86)\Common Files\Intel\Shared Libraries\compiler\lib\mic, npm_package_devDependencies_metro_react_native_babel_preset=^0.59.0, PSModulePath=C:\Program Files\WindowsPowerShell\Modules;C:\WINDOWS\system32\WindowsPowerShell\v1.0\Modules, npm_package_dependencies_axios=^0.18.0, npm_package_dependencies_react_native_date_picker=^4.2.2, npm_package_dependencies_react=16.8.6, npm_package_dependencies_react_native_table_component=^1.1.8, npm_lifecycle_event=apk-bel, npm_package_scripts_test=jest, npm_config_username=vorlovsky, npm_package_version=0.0.8, APP_HOME=D:\Work\SPIC\mobile\android\, npm_package_devDependencies__babel_runtime=^7.5.5, OneDriveConsumer=C:\Users\LJ\OneDrive, npm_package_dependencies_moment=^2.29.3, npm_package_devDependencies_react_test_renderer=16.8.6, npm_config_save_prefix=^, npm_package_dependencies_redux_saga=^0.16.2, npm_package_scripts_start_prod=SET ENVFILE=src/config/.env.prod.bel && react-native start, AIR_NOANDROIDFLAIR=true, ProgramData=C:\ProgramData, ProgramW6432=C:\Program Files, npm_package_dependencies_react_native_local_mongodb=^2.2.3, npm_config_bin_links=true, npm_package_dependencies_react_native_navigation=^3.0.0, LOCALAPPDATA=C:\Users\LJ\AppData\Local, ChocolateyLastPathUpdate=132550867481468656, npm_config_version_commit_hooks=true, npm_package_scripts_simulator=SET ENVFILE=src/config/.env.dev && react-native run-android, USERDOMAIN=DESKTOP-9713OUE, LOGONSERVER=\\DESKTOP-9713OUE, SENTRY_PROPERTIES=D:\Work\SPIC\mobile/android/sentry.properties, ENVFILE=src/config/.env.prod.bel , IDF_TOOLS_PATH=C:\Users\LJ\.espressif, npm_config_init_version=1.0.0, npm_package_dependencies_react_native_permissions=^1.2.1, npm_execpath=C:\Users\LJ\AppData\Roaming\nvm\v16.14.2\node_modules\yarn\bin\yarn.js, npm_package_dependencies_react_native_config=^0.11.6, npm_package_dependencies_react_native_i18n=^2.0.15, npm_package_dependencies_react_native_collapsible=^1.4.0, CommonProgramFiles=C:\Program Files\Common Files, npm_package_dependencies_prop_types=^15.8.1, OS=Windows_NT, npm_package_dependencies_react_native_cached_image=^1.4.3, npm_config_version_tag_prefix=v, ANDROID_SDK_ROOT=D:\Work\SDK\android\sdk, NVM_HOME=C:\Users\LJ\AppData\Roaming\nvm, PROCESSOR_REVISION=1e05, CLASSPATH=D:\Work\SPIC\mobile\android\\gradle\wrapper\gradle-wrapper.jar, CommonProgramW6432=C:\Program Files\Common Files, npm_package_dependencies_react_native_version_number=^0.3.5, npm_package_resolutions_graceful_fs=^4.2.4, npm_package_scripts_app_prod_bel=SET ENVFILE=src/config/.env.prod.bel && react-native run-android -- --reset-cache, npm_package_dependencies__react_native_community_netinfo=4.7.0, npm_package_dependencies_react_native_camera=^3.0.0, SystemRoot=C:\WINDOWS, TEMP=C:\Users\LJ\AppData\Local\Temp, npm_package_devDependencies__babel_core=^7.5.5, USERPROFILE=C:\Users\LJ, TMP=C:\Users\LJ\AppData\Local\Temp, CommonProgramFiles(x86)=C:\Program Files (x86)\Common Files} 22:24:16.868 [DEBUG] [org.gradle.process.internal.DefaultExecHandle] Changing state to: STARTING 22:24:16.869 [DEBUG] [org.gradle.process.internal.DefaultExecHandle] Waiting until process started: command 'cmd'. 22:24:16.892 [DEBUG] [org.gradle.process.internal.DefaultExecHandle] Changing state to: STARTED 22:24:16.892 [DEBUG] [org.gradle.process.internal.ExecHandleRunner] waiting until streams are handled... 22:24:16.893 [INFO] [org.gradle.process.internal.DefaultExecHandle] Successfully started process 'command 'cmd'' 22:24:17.154 [QUIET] [system.out] Processing react-native sourcemaps for Sentry upload. 22:24:17.160 [ERROR] [system.err] error: The system cannot find the file specified. (os error 2) 22:24:17.161 [ERROR] [system.err] 22:24:17.162 [ERROR] [system.err] Add --log-level=[info|debug] or export SENTRY_LOG_LEVEL=[info|debug] to see more output. 22:24:17.162 [ERROR] [system.err] Please attach the full debug log to all bug reports. 22:24:17.180 [DEBUG] [org.gradle.process.internal.DefaultExecHandle] Changing state to: FAILED 22:24:17.181 [DEBUG] [org.gradle.internal.operations.DefaultBuildOperationExecutor] Completing Build operation 'Execute exec for :app:bundleReleaseJsAndAssets_SentryUpload_com.mixoft.spicapp.by@0.0.8+8_8' 22:24:17.181 [DEBUG] [org.gradle.internal.operations.DefaultBuildOperationExecutor] Build operation 'Execute exec for :app:bundleReleaseJsAndAssets_SentryUpload_com.mixoft.spicapp.by@0.0.8+8_8' completed 22:24:17.182 [DEBUG] [org.gradle.api.internal.tasks.execution.ResolveTaskExecutionModeExecuter] Removed task artifact state for {} from context.

[Expected result]

No errors

marandaneto commented 2 years ago

@vorlovsky You should not upgrade the sentry-cli on its own because of compatibility. Can you provide a minimal reproducible example? I've created an example and everything works on this version.

vorlovsky commented 2 years ago

@marandaneto you are definitely right, but I saw an issue in sentry-cli repo that describes almost the same problem and it was mentioned in sentry-cli v.2.3.2 release notes, so I decided to give it a try.

An empty project that could be launched as a debug, but could not be assembled as a release you can find here: https://u.pcloud.link/publink/show?code=XZYuYbVZJDhHPijylw598YiR8dOW9VQxr3iV

marandaneto commented 2 years ago

Apparently, there's a problem with RN 0.60.3. For now, I recommend uploading source maps manually.

bundle {projectRoot}/android/app/build/generated/assets/react/release/index.android.bundle sourcemap {projectRoot}/android/app/build/intermediates/sourcemaps/sourcemaps/release/index.android.bundle.packager.map

INFO 2022-09-05 10:09:51.271413 +02:00 sourcemap path: {projectRoot}/android/app/build/intermediates/sourcemaps/release/index.android.bundle.packager.map error: No such file or directory (os error 2)

The problem is that the sourcemap isn't located.

It should be one of those:

~/{projectRoot}/android ❯ cd app/build ~/{projectRoot}/android/app/build ❯ find . -name "*.map" ./generated/assets/react/release/index.android.bundle.map ./intermediates/merged_assets/release/out/index.android.bundle.map ./intermediates/merged_assets/release/mergeReleaseAssets/out/index.android.bundle.map ./intermediates/assets/release/index.android.bundle.map

We'd need to find out which versions of the RN SDK are using the old path and fallback to that path, since the RN 0.60.x is an old version, not sure it's worth patching it. Can you upgrade your RN engine?

vorlovsky commented 2 years ago

@marandaneto unfortunately, I can't upgrade now. So, there is no way for me to patch the package to make it use actual path?

krystofwoldrich commented 2 years ago

@marandaneto unfortunately, I can't upgrade now. So, there is no way for me to patch the package to make it use actual path?

The manual sourcemaps upload doesn't work for your workflow?

vorlovsky commented 2 years ago

@krystofwoldrich patching path string in the package would be definitely a much easier and solid solution. OK, I can consider your answer as "no".

krystofwoldrich commented 2 years ago

I've researched this problem a bit more and it was/is a React-Native issue which was fixed in 0.60.4 release.

Here is a issue from the time:

If you up your version to 0.60.4 source maps will work correctly.

Release notes: https://github.com/facebook/react-native/releases/tag/v0.60.4

marandaneto commented 2 years ago

@krystofwoldrich mind making a quick PR (adding a new entry for this problem) on https://docs.sentry.io/platforms/react-native/troubleshooting/ ? So people running into this specific issue, will easily find out what to do.

krystofwoldrich commented 2 years ago

https://github.com/getsentry/sentry-docs/pull/5544