Skip to content

Commit

Permalink
firefly hotfix (#11605)
Browse files Browse the repository at this point in the history
* fix: patch useAsyncFn

* refactor: envs

---------

Co-authored-by: Wukong Sun <swkatmask@gmail.com>
  • Loading branch information
guanbinrui and swkatmask committed May 1, 2024
1 parent 6976a47 commit 281c273
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 55 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/compile.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ jobs:
env:
WEB3_CONSTANTS_RPC: ${{ secrets.WEB3_CONSTANTS_RPC }}
MASK_SENTRY_DSN: ${{ secrets.MASK_SENTRY_DSN }}
MASK_SENTRY: ${{ secrets.MASK_SENTRY }}
MASK_MIXPANEL: ${{ secrets.MASK_MIXPANEL }}
steps:
- name: Get cache date
id: get-date
Expand Down
2 changes: 2 additions & 0 deletions packages/mask/.webpack/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,8 @@ export async function createConfiguration(_inputFlags: BuildFlags): Promise<webp
/** JSON.stringify twice */
WEB3_CONSTANTS_RPC: WEB3_CONSTANTS_RPC,
MASK_SENTRY_DSN: process.env.MASK_SENTRY_DSN || '',
MASK_SENTRY: process.env.MASK_SENTRY || JSON.stringify('disabled'),
MASK_MIXPANEL: process.env.MASK_MIXPANEL || JSON.stringify('disabled'),
NEXT_PUBLIC_FIREFLY_API_URL: process.env.NEXT_PUBLIC_FIREFLY_API_URL || '',
}),
new DefinePlugin({
Expand Down
2 changes: 2 additions & 0 deletions packages/polyfills/types/env.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ declare module NodeJS {
interface ProcessEnv {
readonly NODE_ENV: 'development' | 'production' | 'test'
readonly MASK_SENTRY_DSN: string
readonly MASK_SENTRY: 'enabled' | 'disabled'
readonly MASK_MIXPANEL: 'enabled' | 'disabled'
/**
* Run skip tests like
* RUN_SKIP_TESTS=1 pnpm test
Expand Down
8 changes: 4 additions & 4 deletions packages/web3-telemetry/src/providers/Telemetry.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@ import type { CommonOptions, EventID, EventType, ExceptionID, ExceptionType } fr
* A proxy class for all telemetry providers.
*/
export class TelemetryAPI {
private Sentry = new SentryAPI(env)
private Mixpanel = new MixpanelAPI(env)
private Sentry = process.env.MASK_SENTRY === 'enabled' ? new SentryAPI(env) : null
private Mixpanel = process.env.MASK_MIXPANEL === 'enabled' ? new MixpanelAPI(env) : null

captureEvent(eventType: EventType, eventID: EventID, options?: CommonOptions) {
this.Mixpanel.captureEvent({
this.Mixpanel?.captureEvent({
eventType,
eventID,
...options,
Expand All @@ -24,7 +24,7 @@ export class TelemetryAPI {
error: Error,
options?: CommonOptions,
): void {
this.Sentry.captureException({
this.Sentry?.captureException({
exceptionType,
exceptionID,
error,
Expand Down
51 changes: 0 additions & 51 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 281c273

Please sign in to comment.