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

Android/Fix: Read User Authentication token from the environment variable

Open lucas-zimerman opened this issue 1 year ago • 7 comments

:loudspeaker: Type of change

  • [x] Bugfix
  • [ ] New feature
  • [ ] Enhancement
  • [ ] Refactoring

:scroll: Description

In short, use the authentication token if defined on sentry.properties, fallback to the environment variable if defined, otherwise build will fail.

:bulb: Motivation and Context

To fix #3795.

:green_heart: How did you test it?

locally: export SENTRY_AUTH_TOKEN="ABC" then ./gradlew assembleRelease image export SENTRY_AUTH_TOKEN="VALID TOKEN" image

:pencil: Checklist

  • [x] I reviewed submitted code
  • [ ] I added tests to verify changes
  • [x] No new PII added or SDK only sends newly added PII if sendDefaultPII is enabled
  • [ ] All tests passing
  • [x] No breaking changes

:crystal_ball: Next steps

Closes #3795

lucas-zimerman avatar Jun 26 '24 20:06 lucas-zimerman

Android (legacy) Performance metrics :rocket:

  Plain With Sentry Diff
Startup time 402.04 ms 425.82 ms 23.78 ms
Size 17.73 MiB 19.95 MiB 2.21 MiB

Baseline results on branch: main

Startup times

Revision Plain With Sentry Diff
70e6261eb7fdf57e3aba1f72d12c3eb518bcad99 482.65 ms 495.70 ms 13.05 ms
86d6d2c81bc42209de70f7f3b97a1fbbde04025f+dirty 332.90 ms 352.45 ms 19.55 ms
5571a202e0c1fa9393e62c66ebd908444fee9c6e 410.55 ms 441.06 ms 30.51 ms
1d86dd6360b3a0207437816b46e13d91fdeaf4aa 405.14 ms 411.06 ms 5.92 ms
d0bf49472b8e02ea40eab48e2e861b603450233e+dirty 375.37 ms 395.14 ms 19.77 ms
148f9248007774c638943e03dc044cf71dec0c3d 492.65 ms 500.28 ms 7.63 ms
27ef4ee6faa6d5229b16fca7b728ca6b689ab916 317.40 ms 321.70 ms 4.30 ms
5bb8d5f7daec6cd95071caf511b5c2d4006a55ac 431.21 ms 459.40 ms 28.19 ms
25343377820b65409b646b44bc8e9bc9fbb51c8c 394.15 ms 415.12 ms 20.97 ms
80b2ce3d0ebe86bf1196944a2036912f6670295c 385.02 ms 387.36 ms 2.34 ms

App size

Revision Plain With Sentry Diff
70e6261eb7fdf57e3aba1f72d12c3eb518bcad99 17.73 MiB 19.94 MiB 2.21 MiB
86d6d2c81bc42209de70f7f3b97a1fbbde04025f+dirty 17.73 MiB 20.04 MiB 2.31 MiB
5571a202e0c1fa9393e62c66ebd908444fee9c6e 17.73 MiB 19.93 MiB 2.19 MiB
1d86dd6360b3a0207437816b46e13d91fdeaf4aa 17.73 MiB 19.86 MiB 2.12 MiB
d0bf49472b8e02ea40eab48e2e861b603450233e+dirty 17.73 MiB 19.75 MiB 2.02 MiB
148f9248007774c638943e03dc044cf71dec0c3d 17.73 MiB 19.94 MiB 2.21 MiB
27ef4ee6faa6d5229b16fca7b728ca6b689ab916 17.73 MiB 19.82 MiB 2.08 MiB
5bb8d5f7daec6cd95071caf511b5c2d4006a55ac 17.73 MiB 19.93 MiB 2.20 MiB
25343377820b65409b646b44bc8e9bc9fbb51c8c 17.73 MiB 19.84 MiB 2.11 MiB
80b2ce3d0ebe86bf1196944a2036912f6670295c 17.73 MiB 19.75 MiB 2.02 MiB

Previous results on branch: feat/android-env-token

Startup times

Revision Plain With Sentry Diff
b664d496bd1f3eeb786d163de7e5546cda172aee 441.00 ms 475.06 ms 34.06 ms

App size

Revision Plain With Sentry Diff
b664d496bd1f3eeb786d163de7e5546cda172aee 17.73 MiB 19.94 MiB 2.21 MiB

github-actions[bot] avatar Jun 26 '24 20:06 github-actions[bot]

iOS (legacy) Performance metrics :rocket:

  Plain With Sentry Diff
Startup time 1213.96 ms 1214.16 ms 0.20 ms
Size 2.36 MiB 3.04 MiB 698.51 KiB

Baseline results on branch: main

Startup times

Revision Plain With Sentry Diff
148f9248007774c638943e03dc044cf71dec0c3d+dirty 1214.76 ms 1215.73 ms 0.97 ms
31fcca2b37834863733f6f21677efb4b7a490aa8+dirty 1209.17 ms 1216.21 ms 7.04 ms
3ffcddd6248046202afca78f6b9af8e3f591202c+dirty 1244.47 ms 1264.14 ms 19.67 ms
27ef4ee6faa6d5229b16fca7b728ca6b689ab916+dirty 1293.52 ms 1296.08 ms 2.56 ms
e5c9b8b6d5ce209fa4b3a77aa9de65bd590fa727+dirty 1258.57 ms 1267.32 ms 8.75 ms
e2b64fed057d4b01cf7ad79eb19eb3c8b8002a82+dirty 1232.22 ms 1255.20 ms 22.98 ms
1d86dd6360b3a0207437816b46e13d91fdeaf4aa+dirty 1249.71 ms 1279.16 ms 29.45 ms
c398f670f92b4271a2da58363ef9b1d567162273+dirty 1219.67 ms 1225.66 ms 5.99 ms
575f9da84059fc88110565adb1ffc0751799bcf4+dirty 1266.22 ms 1274.84 ms 8.62 ms
25343377820b65409b646b44bc8e9bc9fbb51c8c+dirty 1225.08 ms 1230.26 ms 5.17 ms

App size

Revision Plain With Sentry Diff
148f9248007774c638943e03dc044cf71dec0c3d+dirty 2.36 MiB 3.04 MiB 696.25 KiB
31fcca2b37834863733f6f21677efb4b7a490aa8+dirty 2.36 MiB 2.90 MiB 552.95 KiB
3ffcddd6248046202afca78f6b9af8e3f591202c+dirty 2.36 MiB 2.84 MiB 489.60 KiB
27ef4ee6faa6d5229b16fca7b728ca6b689ab916+dirty 2.36 MiB 2.85 MiB 500.03 KiB
e5c9b8b6d5ce209fa4b3a77aa9de65bd590fa727+dirty 2.36 MiB 2.87 MiB 520.43 KiB
e2b64fed057d4b01cf7ad79eb19eb3c8b8002a82+dirty 2.36 MiB 2.85 MiB 495.80 KiB
1d86dd6360b3a0207437816b46e13d91fdeaf4aa+dirty 2.36 MiB 2.89 MiB 535.43 KiB
c398f670f92b4271a2da58363ef9b1d567162273+dirty 2.36 MiB 3.04 MiB 696.27 KiB
575f9da84059fc88110565adb1ffc0751799bcf4+dirty 2.36 MiB 2.87 MiB 520.20 KiB
25343377820b65409b646b44bc8e9bc9fbb51c8c+dirty 2.36 MiB 2.88 MiB 525.47 KiB

Previous results on branch: feat/android-env-token

Startup times

Revision Plain With Sentry Diff
b664d496bd1f3eeb786d163de7e5546cda172aee+dirty 1237.53 ms 1233.21 ms -4.32 ms

App size

Revision Plain With Sentry Diff
b664d496bd1f3eeb786d163de7e5546cda172aee+dirty 2.36 MiB 3.04 MiB 698.34 KiB

github-actions[bot] avatar Jun 26 '24 20:06 github-actions[bot]

iOS (new) Performance metrics :rocket:

  Plain With Sentry Diff
Startup time 1212.61 ms 1207.89 ms -4.72 ms
Size 2.92 MiB 3.61 MiB 705.53 KiB

Baseline results on branch: main

Startup times

Revision Plain With Sentry Diff
148f9248007774c638943e03dc044cf71dec0c3d+dirty 1220.72 ms 1221.30 ms 0.58 ms
31fcca2b37834863733f6f21677efb4b7a490aa8+dirty 1222.04 ms 1226.51 ms 4.47 ms
3ffcddd6248046202afca78f6b9af8e3f591202c+dirty 1272.22 ms 1273.98 ms 1.76 ms
27ef4ee6faa6d5229b16fca7b728ca6b689ab916+dirty 1236.41 ms 1244.90 ms 8.49 ms
e5c9b8b6d5ce209fa4b3a77aa9de65bd590fa727+dirty 1276.90 ms 1280.92 ms 4.02 ms
e2b64fed057d4b01cf7ad79eb19eb3c8b8002a82+dirty 1285.78 ms 1297.56 ms 11.78 ms
1d86dd6360b3a0207437816b46e13d91fdeaf4aa+dirty 1289.25 ms 1293.36 ms 4.11 ms
c398f670f92b4271a2da58363ef9b1d567162273+dirty 1227.31 ms 1230.00 ms 2.69 ms
575f9da84059fc88110565adb1ffc0751799bcf4+dirty 1272.00 ms 1284.38 ms 12.38 ms
25343377820b65409b646b44bc8e9bc9fbb51c8c+dirty 1220.87 ms 1221.47 ms 0.60 ms

App size

Revision Plain With Sentry Diff
148f9248007774c638943e03dc044cf71dec0c3d+dirty 2.92 MiB 3.60 MiB 701.88 KiB
31fcca2b37834863733f6f21677efb4b7a490aa8+dirty 2.92 MiB 3.46 MiB 557.31 KiB
3ffcddd6248046202afca78f6b9af8e3f591202c+dirty 2.92 MiB 3.40 MiB 494.39 KiB
27ef4ee6faa6d5229b16fca7b728ca6b689ab916+dirty 2.92 MiB 3.41 MiB 503.72 KiB
e5c9b8b6d5ce209fa4b3a77aa9de65bd590fa727+dirty 2.92 MiB 3.43 MiB 524.50 KiB
e2b64fed057d4b01cf7ad79eb19eb3c8b8002a82+dirty 2.92 MiB 3.41 MiB 499.97 KiB
1d86dd6360b3a0207437816b46e13d91fdeaf4aa+dirty 2.92 MiB 3.44 MiB 538.27 KiB
c398f670f92b4271a2da58363ef9b1d567162273+dirty 2.92 MiB 3.60 MiB 701.89 KiB
575f9da84059fc88110565adb1ffc0751799bcf4+dirty 2.92 MiB 3.43 MiB 524.26 KiB
25343377820b65409b646b44bc8e9bc9fbb51c8c+dirty 2.92 MiB 3.43 MiB 529.76 KiB

Previous results on branch: feat/android-env-token

Startup times

Revision Plain With Sentry Diff
b664d496bd1f3eeb786d163de7e5546cda172aee+dirty 1226.08 ms 1221.78 ms -4.31 ms

App size

Revision Plain With Sentry Diff
b664d496bd1f3eeb786d163de7e5546cda172aee+dirty 2.92 MiB 3.61 MiB 705.07 KiB

github-actions[bot] avatar Jun 26 '24 20:06 github-actions[bot]

@lucas-zimerman Have you tested this with the flavorAware flag enabled?

From the PR description, I'm not sure.

krystofwoldrich avatar Jun 28 '24 19:06 krystofwoldrich

Android (new) Performance metrics :rocket:

  Plain With Sentry Diff
Startup time 346.33 ms 367.85 ms 21.53 ms
Size 7.15 MiB 8.22 MiB 1.07 MiB

Baseline results on branch: main

Startup times

Revision Plain With Sentry Diff
80b2ce3d0ebe86bf1196944a2036912f6670295c+dirty 271.29 ms 316.47 ms 45.18 ms
86d6d2c81bc42209de70f7f3b97a1fbbde04025f+dirty 267.21 ms 325.24 ms 58.04 ms
5571a202e0c1fa9393e62c66ebd908444fee9c6e+dirty 359.52 ms 389.80 ms 30.28 ms
d0bf49472b8e02ea40eab48e2e861b603450233e+dirty 253.73 ms 308.23 ms 54.49 ms
22e31b6ad7bd629bf078367aee82121c08977ded+dirty 295.75 ms 346.73 ms 50.98 ms
12427f44d4b7746c431a369b538ec70ab2993c02+dirty 379.48 ms 400.92 ms 21.44 ms
5a22220fafc6352a2e07e20943dda325a4cf67f5+dirty 384.61 ms 419.06 ms 34.45 ms
abb7058e207628f7d3e5ebee6c410c2cf6c361f4+dirty 320.78 ms 324.08 ms 3.30 ms
70e6261eb7fdf57e3aba1f72d12c3eb518bcad99+dirty 395.08 ms 408.12 ms 13.04 ms
148f9248007774c638943e03dc044cf71dec0c3d+dirty 347.36 ms 389.13 ms 41.77 ms

App size

Revision Plain With Sentry Diff
80b2ce3d0ebe86bf1196944a2036912f6670295c+dirty 7.15 MiB 8.04 MiB 911.02 KiB
86d6d2c81bc42209de70f7f3b97a1fbbde04025f+dirty 7.15 MiB 8.09 MiB 962.69 KiB
5571a202e0c1fa9393e62c66ebd908444fee9c6e+dirty 7.15 MiB 8.20 MiB 1.05 MiB
d0bf49472b8e02ea40eab48e2e861b603450233e+dirty 7.15 MiB 8.04 MiB 910.85 KiB
22e31b6ad7bd629bf078367aee82121c08977ded+dirty 7.15 MiB 8.10 MiB 981.29 KiB
12427f44d4b7746c431a369b538ec70ab2993c02+dirty 7.15 MiB 8.12 MiB 997.78 KiB
5a22220fafc6352a2e07e20943dda325a4cf67f5+dirty 7.15 MiB 8.21 MiB 1.06 MiB
abb7058e207628f7d3e5ebee6c410c2cf6c361f4+dirty 7.15 MiB 8.10 MiB 980.40 KiB
70e6261eb7fdf57e3aba1f72d12c3eb518bcad99+dirty 7.15 MiB 8.21 MiB 1.07 MiB
148f9248007774c638943e03dc044cf71dec0c3d+dirty 7.15 MiB 8.21 MiB 1.07 MiB

Previous results on branch: feat/android-env-token

Startup times

Revision Plain With Sentry Diff
b664d496bd1f3eeb786d163de7e5546cda172aee+dirty 370.92 ms 422.47 ms 51.55 ms

App size

Revision Plain With Sentry Diff
b664d496bd1f3eeb786d163de7e5546cda172aee+dirty 7.15 MiB 8.22 MiB 1.07 MiB

github-actions[bot] avatar Jun 28 '24 19:06 github-actions[bot]

@lucas-zimerman Have you tested this with the flavorAware flag enabled?

From the PR description, I'm not sure.

I have tested with the default value so FlavorAware was off.

I have tried with flavor aware = true but it seems like the same isn't working for me (build error) but the reasons seems unrelated to this PR.

lucas-zimerman avatar Jul 02 '24 15:07 lucas-zimerman

@krystofwoldrich after finding the correct flavoraware filename, I was able to test that there are no additional changes for it to read from the environment file: image

lucas-zimerman avatar Jul 03 '24 17:07 lucas-zimerman