Skip to content

Commit 2d1bd0b

Browse files
committed
Fixed hooks files
1 parent f651efb commit 2d1bd0b

File tree

4 files changed

+6
-23
lines changed

4 files changed

+6
-23
lines changed

packages/core/scripts/eas/build-on-complete.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
*
2828
* @see https://docs.expo.dev/build-reference/npm-hooks/
2929
* @see https://docs.sentry.io/platforms/react-native/
30+
*
3031
*/
3132

3233
const { loadEnv, loadHooksModule, parseBaseOptions, runHook } = require('./utils');
@@ -46,6 +47,7 @@ async function main() {
4647
}
4748

4849
main().catch(error => {
50+
// eslint-disable-next-line no-console
4951
console.error('[Sentry] Unexpected error in eas-build-on-complete hook:', error);
5052
process.exit(1);
5153
});

packages/core/scripts/eas/build-on-error.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ async function main() {
3636
}
3737

3838
main().catch(error => {
39+
// eslint-disable-next-line no-console
3940
console.error('[Sentry] Unexpected error in eas-build-on-error hook:', error);
4041
process.exit(1);
4142
});

packages/core/scripts/eas/build-on-success.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ async function main() {
3838
}
3939

4040
main().catch(error => {
41+
// eslint-disable-next-line no-console
4142
console.error('[Sentry] Unexpected error in eas-build-on-success hook:', error);
4243
process.exit(1);
4344
});

packages/core/src/js/tools/easBuildHooks.ts

Lines changed: 2 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,9 @@
1111
*/
1212

1313
/* eslint-disable no-console */
14-
/* eslint-disable no-bitwise */
1514

1615
import type { DsnComponents } from '@sentry/core';
17-
import { dsnToString, makeDsn } from '@sentry/core';
16+
import { dsnToString, makeDsn, uuid4 } from '@sentry/core';
1817

1918
const SENTRY_DSN_ENV = 'SENTRY_DSN';
2019
const EAS_BUILD_ENV = 'EAS_BUILD';
@@ -95,26 +94,6 @@ function getEnvelopeEndpoint(dsn: DsnComponents): string {
9594
return `${protocol}://${host}${portStr}${pathStr}/api/${projectId}/envelope/?sentry_key=${publicKey}&sentry_version=7`;
9695
}
9796

98-
function generateEventId(): string {
99-
const bytes = new Uint8Array(16);
100-
if (typeof crypto !== 'undefined' && crypto.getRandomValues) {
101-
crypto.getRandomValues(bytes);
102-
} else {
103-
for (let i = 0; i < 16; i++) {
104-
bytes[i] = Math.floor(Math.random() * 256);
105-
}
106-
}
107-
const byte6 = bytes[6];
108-
const byte8 = bytes[8];
109-
if (byte6 !== undefined && byte8 !== undefined) {
110-
bytes[6] = (byte6 & 0x0f) | 0x40;
111-
bytes[8] = (byte8 & 0x3f) | 0x80;
112-
}
113-
return Array.from(bytes)
114-
.map(b => b.toString(16).padStart(2, '0'))
115-
.join('');
116-
}
117-
11897
function createEASBuildTags(env: EASBuildEnv): Record<string, string> {
11998
const tags: Record<string, string> = {};
12099
if (env.EAS_BUILD_PLATFORM) tags['eas.platform'] = env.EAS_BUILD_PLATFORM;
@@ -191,7 +170,7 @@ function createBaseEvent(
191170
customTags?: Record<string, string>,
192171
): SentryEvent {
193172
return {
194-
event_id: generateEventId(),
173+
event_id: uuid4(),
195174
timestamp: Date.now() / 1000,
196175
platform: 'node',
197176
level,

0 commit comments

Comments
 (0)