From 33cc7cca0adce9c40f437d4284ce1434a64477cd Mon Sep 17 00:00:00 2001 From: Patrick Fic <> Date: Fri, 24 Jun 2022 13:42:13 -0700 Subject: [PATCH] 1.3.7-4 - Prod Build - Updated sentry logging. --- App.js | 7 ++ app.json | 6 +- .../local-upload-progress.component.jsx | 2 + .../upload-progress.component.jsx | 11 ++- package.json | 3 + redux/user/user.sagas.js | 8 +- util/document-upload.utility.js | 5 + util/local-document-upload.utility.js | 5 + yarn.lock | 91 ++++++++++++++++++- 9 files changed, 130 insertions(+), 8 deletions(-) diff --git a/App.js b/App.js index 3afb8f3..b0385be 100644 --- a/App.js +++ b/App.js @@ -17,6 +17,13 @@ import { SafeAreaProvider } from "react-native-safe-area-context"; Sentry.init({ dsn: "https://8d6c3de1940a4e4f8b81cf4d2150bdea@o492140.ingest.sentry.io/5558869", enableInExpoDevelopment: true, + tracesSampleRate: 0.2, + integrations: [ + new Sentry.Native.ReactNativeTracing({ + tracingOrigins: ["localhost", "imex.online", "cloudinary.com", /^\//], + // ... other options + }), + ], // debug: true, // Sentry will try to print out useful debugging information if something goes wrong with sending an event. Set this to `false` in production. }); diff --git a/app.json b/app.json index e0cd5d6..59f4972 100644 --- a/app.json +++ b/app.json @@ -4,19 +4,19 @@ "slug": "imexmobile", "version": "1.3.7", "extra": { - "expover": "3" + "expover": "4" }, "orientation": "default", "icon": "./assets/logo192noa.png", "ios": { "supportsTablet": true, "bundleIdentifier": "com.imex.imexmobile", - "buildNumber": "3", + "buildNumber": "4", "googleServicesFile": "./GoogleService-Info.plist" }, "android": { "package": "com.imex.imexmobile", - "versionCode": 1100016, + "versionCode": 1100017, "googleServicesFile": "./google-services.json" }, "splash": { diff --git a/components/local-upload-progress/local-upload-progress.component.jsx b/components/local-upload-progress/local-upload-progress.component.jsx index a599f0c..4729cd6 100644 --- a/components/local-upload-progress/local-upload-progress.component.jsx +++ b/components/local-upload-progress/local-upload-progress.component.jsx @@ -18,6 +18,7 @@ import { selectCurrentCameraJobId, selectDeleteAfterUpload, } from "../../redux/app/app.selectors"; +import * as Sentry from "sentry-expo"; import { formatBytes } from "../../util/document-upload.utility"; import { handleLocalUpload } from "../../util/local-document-upload.utility"; @@ -63,6 +64,7 @@ export function UploadProgress({ await MediaLibrary.deleteAssetsAsync(data); } catch (error) { console.log("Unable to delete picture.", error); + Sentry.Native.captureException(error); } } diff --git a/components/upload-progress/upload-progress.component.jsx b/components/upload-progress/upload-progress.component.jsx index fe25a65..2b1bd41 100644 --- a/components/upload-progress/upload-progress.component.jsx +++ b/components/upload-progress/upload-progress.component.jsx @@ -27,6 +27,7 @@ import { } from "../../redux/user/user.selectors"; import { formatBytes, handleUpload } from "../../util/document-upload.utility"; import Toast from "react-native-toast-message"; +import * as Sentry from "sentry-expo"; const mapStateToProps = createStructuredSelector({ currentUser: selectCurrentUser, @@ -112,7 +113,7 @@ export function UploadProgress({ logImEXEvent("imexmobile_upload_documents_error", { error }); Toast.show({ type: "error", - text1: "Unable to upload documents.", + text1: "Unable to upload document.", text2: error, autoHide: false, }); @@ -216,10 +217,16 @@ export function UploadProgress({ ); } catch (error) { console.log("Unable to delete picture.", error); + Sentry.Native.captureException(error); } } filesToDelete = []; - + Toast.show({ + type: "success", + text1: ` Upload completed.`, + // + // text2: duration, + }); //Reset state. setProgress({ diff --git a/package.json b/package.json index 5bf82ee..64d1402 100644 --- a/package.json +++ b/package.json @@ -26,13 +26,16 @@ "@react-navigation/drawer": "^6.3.1", "@react-navigation/native": "^6.0.8", "@react-navigation/stack": "^6.1.1", + "@sentry/react-native": "^4.0.1", "axios": "^0.27.2", "cloudinary-core": "^2.12.3", "dinero.js": "^1.9.1", "expo": "^45.0.5", "expo-app-loading": "~2.0.0", + "expo-application": "~4.1.0", "expo-av": "~11.2.3", "expo-camera": "~12.2.0", + "expo-constants": "~13.1.1", "expo-device": "~4.2.0", "expo-file-system": "~14.0.0", "expo-firebase-analytics": "~7.0.0", diff --git a/redux/user/user.sagas.js b/redux/user/user.sagas.js index f4a60bb..405846d 100644 --- a/redux/user/user.sagas.js +++ b/redux/user/user.sagas.js @@ -1,11 +1,13 @@ import * as Analytics from "expo-firebase-analytics"; +import { signInWithEmailAndPassword, signOut } from "firebase/auth"; import { all, call, put, takeLatest } from "redux-saga/effects"; +import * as Sentry from "sentry-expo"; +import { logImEXEvent } from "../../firebase/firebase.analytics"; import { auth, getCurrentUser, updateCurrentUser, } from "../../firebase/firebase.utils"; -import { logImEXEvent } from "../../firebase/firebase.analytics"; import { QUERY_BODYSHOP } from "../../graphql/bodyshop.queries"; import { client } from "../../graphql/client"; import { @@ -22,7 +24,6 @@ import { validatePasswordResetSuccess, } from "./user.actions"; import UserActionTypes from "./user.types"; -import { signInWithEmailAndPassword, signOut } from "firebase/auth"; export function* onEmailSignInStart() { yield takeLatest(UserActionTypes.EMAIL_SIGN_IN_START, signInWithEmail); @@ -42,6 +43,7 @@ export function* signInWithEmail({ payload: { email, password } }) { ); } catch (error) { yield put(signInFailure(error)); + //logImEXEvent("redux_sign_in_failure", { user: email, error }); } } @@ -106,6 +108,7 @@ export function* onSignInSuccess() { export function* signInSuccessSaga({ payload }) { try { Analytics.setUserId(payload.email); + Sentry.Native.setUser({ email: payload.email }); const shop = yield client.query({ query: QUERY_BODYSHOP }); logImEXEvent("imexmobile_sign_in_success", payload); @@ -119,6 +122,7 @@ export function* signInSuccessSaga({ payload }) { // ); } catch (error) { console.log("UH-OH. Couldn't get shop details.", error); + Sentry.Native.captureException(error); } } diff --git a/util/document-upload.utility.js b/util/document-upload.utility.js index 9249cbe..7e6675f 100644 --- a/util/document-upload.utility.js +++ b/util/document-upload.utility.js @@ -5,6 +5,7 @@ import { INSERT_NEW_DOCUMENT } from "../graphql/documents.queries"; import { axiosAuthInterceptorId } from "./CleanAxios"; import * as MediaLibrary from "expo-media-library"; import { gql } from "@apollo/client"; +import * as Sentry from "sentry-expo"; //Context: currentUserEmail, bodyshop, jobid, invoiceid @@ -70,6 +71,8 @@ export const uploadToCloudinary = async ( }); } catch (error) { console.log("ERROR GETTING SIGNED URL", error); + Sentry.Native.captureException(error); + return { success: false, error: error }; } @@ -117,6 +120,8 @@ export const uploadToCloudinary = async ( ); } catch (error) { console.log("CLOUDINARY error", error.response, cloudinaryUploadResponse); + Sentry.Native.captureException(error); + if (onError) onError(error.message); return { success: false, error: error }; } diff --git a/util/local-document-upload.utility.js b/util/local-document-upload.utility.js index 97e529b..abde594 100644 --- a/util/local-document-upload.utility.js +++ b/util/local-document-upload.utility.js @@ -2,6 +2,7 @@ import axios from "axios"; import { store } from "../redux/store"; import mime from "mime"; import * as MediaLibrary from "expo-media-library"; +import * as Sentry from "sentry-expo"; axios.interceptors.request.use( function (config) { @@ -94,11 +95,15 @@ export const handleLocalUpload = async ({ }); } } catch (error) { + Sentry.Native.captureException(error); + console.log("Error uploading documents:", error.message); onError && onError({ error: error.message }); } } catch (error) { console.log("Uncaught error", error); + Sentry.Native.captureException(error); + onError && onError({ error: error.message }); } }; diff --git a/yarn.lock b/yarn.lock index c96f8c3..203139d 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2362,6 +2362,16 @@ "@sentry/utils" "6.19.2" tslib "^1.9.3" +"@sentry/browser@7.1.1": + version "7.1.1" + resolved "https://registry.yarnpkg.com/@sentry/browser/-/browser-7.1.1.tgz#2d1fe4a81e0d9679aa73c5ae69a0958e4e42b422" + integrity sha512-5AQvStZ+nOP/yxsBmeMZpeGLVtuOgnCNvswKd/c1CJwNw7bDmCE4TQeNKp1C3Gb7lSdBk8ViwUKn0ZpoVQ5MTw== + dependencies: + "@sentry/core" "7.1.1" + "@sentry/types" "7.1.1" + "@sentry/utils" "7.1.1" + tslib "^1.9.3" + "@sentry/browser@^6.12.0": version "6.19.7" resolved "https://registry.yarnpkg.com/@sentry/browser/-/browser-6.19.7.tgz#a40b6b72d911b5f1ed70ed3b4e7d4d4e625c0b5f" @@ -2372,7 +2382,7 @@ "@sentry/utils" "6.19.7" tslib "^1.9.3" -"@sentry/cli@^1.52.4", "@sentry/cli@^1.74.2": +"@sentry/cli@^1.52.4", "@sentry/cli@^1.74.2", "@sentry/cli@^1.74.4": version "1.74.4" resolved "https://registry.yarnpkg.com/@sentry/cli/-/cli-1.74.4.tgz#7df82f68045a155e1885bfcbb5d303e5259eb18e" integrity sha512-BMfzYiedbModsNBJlKeBOLVYUtwSi99LJ8gxxE4Bp5N8hyjNIN0WVrozAVZ27mqzAuy6151Za3dpmOLO86YlGw== @@ -2407,6 +2417,16 @@ "@sentry/utils" "6.19.7" tslib "^1.9.3" +"@sentry/core@7.1.1": + version "7.1.1" + resolved "https://registry.yarnpkg.com/@sentry/core/-/core-7.1.1.tgz#85f73f8037eec61e37549998de03a6d3d3c635b5" + integrity sha512-SADdAoG5u1LTJhPN5KPtn5HHmH6r0mr6h2LokuZnhj6/okrAuCIIKOb6Fh8jV7j2VuABvew8+FjJHORxi7D/3Q== + dependencies: + "@sentry/hub" "7.1.1" + "@sentry/types" "7.1.1" + "@sentry/utils" "7.1.1" + tslib "^1.9.3" + "@sentry/hub@6.19.2": version "6.19.2" resolved "https://registry.yarnpkg.com/@sentry/hub/-/hub-6.19.2.tgz#0e9f9c507e55d8396002f644b43ef27cc9ff1289" @@ -2425,6 +2445,15 @@ "@sentry/utils" "6.19.7" tslib "^1.9.3" +"@sentry/hub@7.1.1": + version "7.1.1" + resolved "https://registry.yarnpkg.com/@sentry/hub/-/hub-7.1.1.tgz#d6aa54e7bd20a71cebd602701dd29d5d581d391a" + integrity sha512-ASsRVjYDIii6ZTf36JnIYKHWBQBk0P42Tgq324MpyPgaeVDg3saBcyXO5iAtWvY6Vmdi2H4JCVDoir2Zz3Me1w== + dependencies: + "@sentry/types" "7.1.1" + "@sentry/utils" "7.1.1" + tslib "^1.9.3" + "@sentry/integrations@6.19.2": version "6.19.2" resolved "https://registry.yarnpkg.com/@sentry/integrations/-/integrations-6.19.2.tgz#d5abcab94ae23ada097eb454c269e9ab573e14bb" @@ -2435,6 +2464,16 @@ localforage "^1.8.1" tslib "^1.9.3" +"@sentry/integrations@7.1.1": + version "7.1.1" + resolved "https://registry.yarnpkg.com/@sentry/integrations/-/integrations-7.1.1.tgz#e0d512e0e44bbcd1f1fab0808312615dd7aa1439" + integrity sha512-FAkxuY/3O9xc+1CTovouhQyHycMrWlCYZw+oB0AOJUug1Vcq+XRPNG4gRpwt/HNFGuu7VjPXvk4ZQc60g1CQww== + dependencies: + "@sentry/types" "7.1.1" + "@sentry/utils" "7.1.1" + localforage "^1.8.1" + tslib "^1.9.3" + "@sentry/integrations@^6.12.0": version "6.19.7" resolved "https://registry.yarnpkg.com/@sentry/integrations/-/integrations-6.19.7.tgz#e6e126b692077c8731644224c754012bed65b425" @@ -2479,6 +2518,22 @@ "@sentry/utils" "6.19.2" "@sentry/wizard" "^1.2.17" +"@sentry/react-native@^4.0.1": + version "4.0.1" + resolved "https://registry.yarnpkg.com/@sentry/react-native/-/react-native-4.0.1.tgz#6fa8588e46f1b92fcd2a7945798a887f87876244" + integrity sha512-+syd3j0rOC7TTetWY/qW8GoATDPzZ5uANDm2wi2OM/tyvLeSEqYiBeBYC0CP+xTGIjHnBAN6NiLU+0sWqMyRcQ== + dependencies: + "@sentry/browser" "7.1.1" + "@sentry/cli" "^1.74.4" + "@sentry/core" "7.1.1" + "@sentry/hub" "7.1.1" + "@sentry/integrations" "7.1.1" + "@sentry/react" "7.1.1" + "@sentry/tracing" "7.1.1" + "@sentry/types" "7.1.1" + "@sentry/utils" "7.1.1" + "@sentry/wizard" "^1.2.17" + "@sentry/react@6.19.2": version "6.19.2" resolved "https://registry.yarnpkg.com/@sentry/react/-/react-6.19.2.tgz#67760aed06d7e54a2e117cd9048ad19d573c78f1" @@ -2491,6 +2546,17 @@ hoist-non-react-statics "^3.3.2" tslib "^1.9.3" +"@sentry/react@7.1.1": + version "7.1.1" + resolved "https://registry.yarnpkg.com/@sentry/react/-/react-7.1.1.tgz#13d63384d1a8c916b96ea79b74fc419ba967fb6a" + integrity sha512-Z7cZvXHIWxg7OhOSy4InhrRgQPRNtHsyOkIAHkgwW32JYOGTg1HdqQ5mFUxQLejhU/YqsxVjTK4CI58FATykLw== + dependencies: + "@sentry/browser" "7.1.1" + "@sentry/types" "7.1.1" + "@sentry/utils" "7.1.1" + hoist-non-react-statics "^3.3.2" + tslib "^1.9.3" + "@sentry/tracing@6.19.2": version "6.19.2" resolved "https://registry.yarnpkg.com/@sentry/tracing/-/tracing-6.19.2.tgz#ed6ff1bc901c4d79ef97f77ed54ce58c650e4915" @@ -2502,6 +2568,16 @@ "@sentry/utils" "6.19.2" tslib "^1.9.3" +"@sentry/tracing@7.1.1": + version "7.1.1" + resolved "https://registry.yarnpkg.com/@sentry/tracing/-/tracing-7.1.1.tgz#8996c0913803d3c4a103388c9c0dd2410cca8478" + integrity sha512-MJ+EPGfvPlgbJOcZRoIl6+Oi0oRE2nIi/HP2BPJSKGxXFi2Y09bcZUwfxOH8fkUa465jOGBFdCm+sXcbyExvuw== + dependencies: + "@sentry/hub" "7.1.1" + "@sentry/types" "7.1.1" + "@sentry/utils" "7.1.1" + tslib "^1.9.3" + "@sentry/types@6.19.2": version "6.19.2" resolved "https://registry.yarnpkg.com/@sentry/types/-/types-6.19.2.tgz#0219c9da21ed975951108b8541913b1966464435" @@ -2512,6 +2588,11 @@ resolved "https://registry.yarnpkg.com/@sentry/types/-/types-6.19.7.tgz#c6b337912e588083fc2896eb012526cf7cfec7c7" integrity sha512-jH84pDYE+hHIbVnab3Hr+ZXr1v8QABfhx39KknxqKWr2l0oEItzepV0URvbEhB446lk/S/59230dlUUIBGsXbg== +"@sentry/types@7.1.1": + version "7.1.1" + resolved "https://registry.yarnpkg.com/@sentry/types/-/types-7.1.1.tgz#63aa68e7be36d63cc305d01af9119a4cdb186ae3" + integrity sha512-5N1UMd2SqvUXprcIUMyDEju3H9lJY2oWfWQBGo0lG6Amn/lGAPAYlchg+4vQCLutDQMyd8K9zPwcbKn4u6gHdw== + "@sentry/utils@6.19.2": version "6.19.2" resolved "https://registry.yarnpkg.com/@sentry/utils/-/utils-6.19.2.tgz#995efb896c5159369509f4896c27a2d2ea9191f2" @@ -2528,6 +2609,14 @@ "@sentry/types" "6.19.7" tslib "^1.9.3" +"@sentry/utils@7.1.1": + version "7.1.1" + resolved "https://registry.yarnpkg.com/@sentry/utils/-/utils-7.1.1.tgz#7174a1439f8970510207fa7587385119397e1718" + integrity sha512-DPRHDf3InfyVgmxToE4Z+AATAR4OVm+wsXDLFGGyncR91CE1x4wLQKOcAJJwX3F0Hz1VHENfmx1DvyYTHOrC/A== + dependencies: + "@sentry/types" "7.1.1" + tslib "^1.9.3" + "@sentry/wizard@^1.2.17": version "1.2.17" resolved "https://registry.yarnpkg.com/@sentry/wizard/-/wizard-1.2.17.tgz#c3247b47129d002cfa45d7a2048d13dc6513457b"