diff --git a/.env b/.env index d2afc6525f1..2bee64a57d4 100644 --- a/.env +++ b/.env @@ -36,3 +36,4 @@ SHOW_NOT_IMPLEMENTED_FEATURES=0 ENABLE_ALERT_BANNER=0 FLAG_WALLET_CONNECT_ENABLED=1 API_LOGGING_ENABLED=1 +SENTRY_ENVIRONMENT=ci-main diff --git a/.env.e2e b/.env.e2e index 54454a0a815..3a472512988 100644 --- a/.env.e2e +++ b/.env.e2e @@ -40,3 +40,4 @@ ENABLE_ALERT_BANNER=0 FLAG_WALLET_CONNECT_ENABLED=1 MOBILE_DATA_SYNCING_TOGGLE_ENABLE=0 API_LOGGING_ENABLED=1 +SENTRY_ENVIRONMENT=ci-main diff --git a/.env.jenkins b/.env.jenkins index 041440679d2..3376e24ffb9 100644 --- a/.env.jenkins +++ b/.env.jenkins @@ -37,3 +37,4 @@ TEST_NETWORKS_ENABLED=1 ENABLE_ALERT_BANNER=1 FLAG_WALLET_CONNECT_ENABLED=1 API_LOGGING_ENABLED=1 +SENTRY_ENVIRONMENT=ci-main diff --git a/.env.nightly b/.env.nightly index cf21f031e94..748692e487e 100644 --- a/.env.nightly +++ b/.env.nightly @@ -24,3 +24,4 @@ TEST_NETWORKS_ENABLED=0 ENABLE_ALERT_BANNER=1 FLAG_WALLET_CONNECT_ENABLED=1 API_LOGGING_ENABLED=1 +SENTRY_ENVIRONMENT=ci-nightly diff --git a/.env.release b/.env.release index c34df0d0eee..4edcc8be344 100644 --- a/.env.release +++ b/.env.release @@ -21,3 +21,4 @@ TEST_NETWORKS_ENABLED=0 STATUS_PROXY_STAGE_NAME=prod FLAG_WALLET_CONNECT_ENABLED=1 API_LOGGING_ENABLED=0 +SENTRY_ENVIRONMENT=production diff --git a/ci/Jenkinsfile.android b/ci/Jenkinsfile.android index 0521475aef5..cdc38ca72b5 100644 --- a/ci/Jenkinsfile.android +++ b/ci/Jenkinsfile.android @@ -1,5 +1,5 @@ #!/usr/bin/env groovy -library 'status-jenkins-lib@v1.9.13' +library 'status-jenkins-lib@v1.9.15' /* Options section can't access functions in objects. */ def isPRBuild = utils.isPRBuild() @@ -41,6 +41,7 @@ pipeline { BUILD_ENV = 'prod' NIX_CONF_DIR = "${env.WORKSPACE}/nix" FASTLANE_DISABLE_COLORS = 1 + SENTRY_PRODUCTION = "${utils.isReleaseBuild() ? 'true' : 'false'}" } stages { diff --git a/ci/Jenkinsfile.combined b/ci/Jenkinsfile.combined index 640802fdffd..1adaf753c18 100644 --- a/ci/Jenkinsfile.combined +++ b/ci/Jenkinsfile.combined @@ -1,5 +1,5 @@ #!/usr/bin/env groovy -library 'status-jenkins-lib@v1.9.13' +library 'status-jenkins-lib@v1.9.15' import groovy.json.JsonBuilder diff --git a/ci/Jenkinsfile.ios b/ci/Jenkinsfile.ios index e2cb9fe836d..b4ccc23fc39 100644 --- a/ci/Jenkinsfile.ios +++ b/ci/Jenkinsfile.ios @@ -1,5 +1,5 @@ #!/usr/bin/env groovy -library 'status-jenkins-lib@v1.9.13' +library 'status-jenkins-lib@v1.9.15' /* Options section can't access functions in objects. */ def isPRBuild = utils.isPRBuild() @@ -41,6 +41,7 @@ pipeline { NIX_CONF_DIR = "${env.WORKSPACE}/nix" FASTLANE_DISABLE_COLORS = 1 BUNDLE_PATH = "${HOME}/.bundle" + SENTRY_PRODUCTION = "${utils.isReleaseBuild() ? 'true' : 'false'}" } stages { diff --git a/modules/react-native-status/android/src/main/java/im/status/ethereum/module/StatusModule.kt b/modules/react-native-status/android/src/main/java/im/status/ethereum/module/StatusModule.kt index 720e89f9a80..df2f2206f23 100644 --- a/modules/react-native-status/android/src/main/java/im/status/ethereum/module/StatusModule.kt +++ b/modules/react-native-status/android/src/main/java/im/status/ethereum/module/StatusModule.kt @@ -108,6 +108,15 @@ class StatusModule(private val reactContext: ReactApplicationContext, private va ) } + @ReactMethod + fun intendedPanic(message: String) { + StatusBackendClient.executeStatusGoRequest( + endpoint = "IntendedPanic", + requestBody = message, + statusgoFunction = { Statusgo.intendedPanic(message) }, + ) + } + @ReactMethod fun addCentralizedMetric(request: String, callback: Callback) { StatusBackendClient.executeStatusGoRequestWithCallback( diff --git a/modules/react-native-status/ios/RCTStatus/RCTStatus.m b/modules/react-native-status/ios/RCTStatus/RCTStatus.m index 00842f9dea1..73b9902f171 100644 --- a/modules/react-native-status/ios/RCTStatus/RCTStatus.m +++ b/modules/react-native-status/ios/RCTStatus/RCTStatus.m @@ -109,6 +109,17 @@ - (void)handleSignal:(NSString *)signal callback:callback]; } +RCT_EXPORT_METHOD(intendedPanic:(NSString *)message) { +#if DEBUG + NSLog(@"IntendedPanic() method called"); +#endif + [StatusBackendClient executeStatusGoRequest:@"IntendedPanic" + body:message + statusgoFunction:^NSString *{ + return StatusgoIntendedPanic(message); + }]; +} + RCT_EXPORT_BLOCKING_SYNCHRONOUS_METHOD(fleets) { return [StatusBackendClient executeStatusGoRequestWithResult:@"Fleets" body:@"" diff --git a/nix/status-go/mobile/build.nix b/nix/status-go/mobile/build.nix index 6f3872f73c6..1e503798d3d 100644 --- a/nix/status-go/mobile/build.nix +++ b/nix/status-go/mobile/build.nix @@ -1,6 +1,6 @@ { callPackage, lib, buildGoPackage , androidPkgs, openjdk, gomobile, xcodeWrapper, removeReferencesTo -, go-bindata, mockgen, protobuf3_20, protoc-gen-go +, go-bindata, mockgen, protobuf3_20, protoc-gen-go, git , meta , source , platform ? "android" @@ -11,7 +11,7 @@ , outputFileName ? "status-go-${source.shortRev}-${platform}.aar" }: let - inherit (lib) concatStringsSep optionalString optional splitString; + inherit (lib) concatStringsSep optionalString optional splitString fileContents; isIOS = platform == "ios"; isAndroid = platform == "android"; enforceXCodeAvailable = callPackage ./enforceXCodeAvailable.nix { }; @@ -29,7 +29,7 @@ in buildGoPackage rec { extraSrcPaths = [ gomobile ]; nativeBuildInputs = [ - gomobile removeReferencesTo go-bindata mockgen protoc-gen-go protobuf3_20 + gomobile removeReferencesTo go-bindata mockgen protoc-gen-go protobuf3_20 git ] ++ optional isAndroid openjdk ++ optional isIOS xcodeWrapper; @@ -46,12 +46,25 @@ in buildGoPackage rec { # TODO: try removing when go is upgraded to 1.22 GODEBUG = "netdns=cgo+2"; - preBuild = '' - echo 'Generate static files' - pushd go/src/$goPackagePath - make generate SHELL=$SHELL GO111MODULE=on GO_GENERATE_CMD='go generate' - popd - ''; + # Sentry for status-go + SENTRY_CONTEXT_NAME = "status-mobile"; + SENTRY_CONTEXT_VERSION = version; + + gitRoot= "go/src/${goPackagePath}"; + + preBuild = '' + # To fix fatal: not a git repository (or any of the parent directories): .git + git init --quiet --initial-branch=main . + git config user.email "nix@builder" + git config user.name "Nix Builder" + git commit --quiet --allow-empty -m "Initial commit" + git tag -a "v${source.version}" -m "Version ${source.version}" + + echo 'Generate static files' + pushd ${gitRoot} + make generate SHELL=$SHELL GO111MODULE=on GO_GENERATE_CMD='go generate' + popd + ''; buildPhase = '' runHook preBuild diff --git a/scripts/build-android.sh b/scripts/build-android.sh index 063bf39f9de..0ffaa8ab1f5 100755 --- a/scripts/build-android.sh +++ b/scripts/build-android.sh @@ -47,6 +47,7 @@ SECRETS_ENV_VARS=( 'MIXPANEL_APP_ID' 'MIXPANEL_TOKEN' 'POKT_TOKEN' + 'SENTRY_DSN_STATUS_GO' ) # Secrets like this can't be passed via args or they end up in derivation. diff --git a/shadow-cljs.edn b/shadow-cljs.edn index b5d76405965..3380a5a3500 100644 --- a/shadow-cljs.edn +++ b/shadow-cljs.edn @@ -77,6 +77,11 @@ #shadow/env "STATUS_BACKEND_SERVER_IMAGE_SERVER_URI_PREFIX" status-im.config/STATUS_BACKEND_SERVER_ROOT_DATA_DIR #shadow/env "STATUS_BACKEND_SERVER_ROOT_DATA_DIR" + + ;; Uncomment this line during development if you want to test the integration with Sentry. + ;; + ;; status-im.config/SENTRY_DSN_STATUS_GO #shadow/env "SENTRY_DSN_STATUS_GO" + status-im.config/MIXPANEL_APP_ID #shadow/env "MIXPANEL_APP_ID" status-im.config/MIXPANEL_TOKEN #shadow/env "MIXPANEL_TOKEN" status-im.config/OPENSEA_API_KEY #shadow/env "OPENSEA_API_KEY" @@ -128,6 +133,7 @@ status-im.config/ALCHEMY_OPTIMISM_SEPOLIA_TOKEN #shadow/env "ALCHEMY_OPTIMISM_SEPOLIA_TOKEN" status-im.config/ALCHEMY_BASE_MAINNET_TOKEN #shadow/env "ALCHEMY_BASE_MAINNET_TOKEN" status-im.config/ALCHEMY_BASE_SEPOLIA_TOKEN #shadow/env "ALCHEMY_BASE_SEPOLIA_TOKEN"} + status-im.config/SENTRY_DSN_STATUS_GO #shadow/env "SENTRY_DSN_STATUS_GO" :compiler-options {:output-feature-set :es6 ;;disable for android build as there ;;is an intermittent warning with deftype diff --git a/src/legacy/status_im/ui/screens/advanced_settings/views.cljs b/src/legacy/status_im/ui/screens/advanced_settings/views.cljs index e5e883734d4..5d3e767df4f 100644 --- a/src/legacy/status_im/ui/screens/advanced_settings/views.cljs +++ b/src/legacy/status_im/ui/screens/advanced_settings/views.cljs @@ -1,10 +1,13 @@ (ns legacy.status-im.ui.screens.advanced-settings.views (:require + [clojure.string :as string] [legacy.status-im.ui.components.core :as components] [legacy.status-im.ui.components.list.item :as list.item] [legacy.status-im.ui.components.list.views :as list] [quo.core :as quo] [re-frame.core :as re-frame] + [status-im.config :as config] + [status-im.feature-flags :as ff] [utils.i18n :as i18n] [utils.re-frame :as rf]) (:require-macros [legacy.status-im.utils.views :as views])) @@ -17,7 +20,16 @@ peer-syncing-enabled?]}] (keep identity - [{:size :small + [(when (ff/enabled? ::ff/app-monitoring.intentional-crash) + {:size :small + :title (str "Force crash immediately" + (when (string/blank? config/sentry-dsn-status-go) + " (Sentry DSN is not set)")) + :accessibility-label :intended-panic + :on-press (fn [] + (re-frame/dispatch [:app-monitoring/intended-panic + "status-mobile intentional panic"]))}) + {:size :small :title (i18n/label :t/log-level) :accessibility-label :log-level-settings-button :on-press diff --git a/src/native_module/core.cljs b/src/native_module/core.cljs index fdc1ba560cd..d9bd6bd7a3a 100644 --- a/src/native_module/core.cljs +++ b/src/native_module/core.cljs @@ -565,3 +565,7 @@ (.createAccountFromPrivateKey ^js (account-manager) (types/clj->json {:privateKey private-key}) callback))) + +(defn intended-panic + [message] + (.intendedPanic ^js (status) message)) diff --git a/src/status_im/common/app_monitoring/effects.cljs b/src/status_im/common/app_monitoring/effects.cljs new file mode 100644 index 00000000000..7939d6f942c --- /dev/null +++ b/src/status_im/common/app_monitoring/effects.cljs @@ -0,0 +1,8 @@ +(ns status-im.common.app-monitoring.effects + (:require + [native-module.core :as native-module] + [utils.re-frame :as rf])) + +(rf/reg-fx :effects.app-monitoring/intended-panic + (fn [message] + (native-module/intended-panic message))) diff --git a/src/status_im/common/app_monitoring/events.cljs b/src/status_im/common/app_monitoring/events.cljs new file mode 100644 index 00000000000..d66ab5c6ef8 --- /dev/null +++ b/src/status_im/common/app_monitoring/events.cljs @@ -0,0 +1,8 @@ +(ns status-im.common.app-monitoring.events + (:require + status-im.common.app-monitoring.effects + [utils.re-frame :as rf])) + +(rf/reg-event-fx :app-monitoring/intended-panic + (fn [_ [message]] + {:fx [[:effects.app-monitoring/intended-panic message]]})) diff --git a/src/status_im/config.cljs b/src/status_im/config.cljs index 6c03dc424e9..f62f04c6830 100644 --- a/src/status_im/config.cljs +++ b/src/status_im/config.cljs @@ -131,3 +131,7 @@ (def re-frisk-host (get-config :RE_FRISK_HOST "localhost")) (def re-frisk-port (get-config :RE_FRISK_PORT "4567")) +;;;; Sentry +;; Documentation: status-go/internal/sentry/README.md +(goog-define SENTRY_DSN_STATUS_GO "") +(def sentry-dsn-status-go SENTRY_DSN_STATUS_GO) diff --git a/src/status_im/contexts/profile/events.cljs b/src/status_im/contexts/profile/events.cljs index 0b32c07fb3f..fa0f053341b 100644 --- a/src/status_im/contexts/profile/events.cljs +++ b/src/status_im/contexts/profile/events.cljs @@ -37,6 +37,7 @@ {:dataDir (native-module/backup-disabled-data-dir) :mixpanelAppId config/mixpanel-app-id :mixpanelToken config/mixpanel-token + :sentryDSN config/sentry-dsn-status-go :mediaServerEnableTLS (config/enabled? config/STATUS_BACKEND_SERVER_MEDIA_SERVER_ENABLE_TLS) :logEnabled (not (string/blank? config/log-level)) :logLevel config/log-level diff --git a/src/status_im/events.cljs b/src/status_im/events.cljs index e1eee0fabfb..f78e92ac40d 100644 --- a/src/status_im/events.cljs +++ b/src/status_im/events.cljs @@ -2,6 +2,7 @@ (:require status-im.common.alert-banner.events status-im.common.alert.effects + status-im.common.app-monitoring.events status-im.common.async-storage.effects status-im.common.emoji-picker.events status-im.common.font.events diff --git a/src/status_im/feature_flags.cljs b/src/status_im/feature_flags.cljs index 1d175453fe6..9afb611924d 100644 --- a/src/status_im/feature_flags.cljs +++ b/src/status_im/feature_flags.cljs @@ -12,6 +12,7 @@ (def ^:private initial-flags {::community.edit-account-selection (enabled-in-env? :FLAG_EDIT_ACCOUNT_SELECTION_ENABLED) ::community.view-token-requirements (enabled-in-env? :FLAG_VIEW_TOKEN_REQUIREMENTS) + ::app-monitoring.intentional-crash (enabled-in-env? :FLAG_INTENTIONAL_CRASH_ENABLED) ;; Feature toggled (off by default) because the desktop app disabled this ;; feature and we want both clients in sync. We keep the code because it diff --git a/src/tests/test_utils.cljs b/src/tests/test_utils.cljs index 972e2037516..c3253e4d4c2 100644 --- a/src/tests/test_utils.cljs +++ b/src/tests/test_utils.cljs @@ -123,12 +123,9 @@ (def status (clj->js - {:getNodeConfig - (fn [] (types/clj->json {:WakuV2Config ""})) - :addCentralizedMetric - (fn [_ callback] - (callback)) - :fleets - (fn [] (.fleets native-status)) - :startLocalNotifications - identity})) + {:intendedPanic identity + :getNodeConfig (fn [] (types/clj->json {:WakuV2Config ""})) + :addCentralizedMetric (fn [_ callback] + (callback)) + :fleets (fn [] (.fleets native-status)) + :startLocalNotifications identity})) diff --git a/status-go-version.json b/status-go-version.json index 244c1d7e56f..d39f630a78e 100644 --- a/status-go-version.json +++ b/status-go-version.json @@ -3,7 +3,7 @@ "_comment": "Instead use: scripts/update-status-go.sh ", "owner": "status-im", "repo": "status-go", - "version": "v9.2.0", - "commit-sha1": "41743c6ca0bb0a1ff4510bfa3575948d477e6284", - "src-sha256": "1awd04bsxkglbgd0nk5mdz2sm17pxkcj47hfslczsppww7yhmc9n" + "version": "fix-path-to-version-sh", + "commit-sha1": "bbeb7078d4f753f9a1bf05feb2b2fea73d9c1a9e", + "src-sha256": "0bck8i63f5pys2lxzgwvgfqjhf475ihsvbv01807l5izvwk94v26" }