Skip to content

Commit

Permalink
Fixed issue with error reporting
Browse files Browse the repository at this point in the history
  • Loading branch information
aklarfeld committed Sep 29, 2023
1 parent 0f14d7d commit 2e3b885
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ const errors = {
'No Client Secret Provided, set SUPERGOOD_CLIENT_SECRET or pass it as an argument'
};

const TestErrorPath = '/supergood-test-error';
const TestErrorPath = '/api/supergood-test-error';
const LocalClientId = 'local-client-id';
const LocalClientSecret = 'local-client-secret';

Expand Down
6 changes: 3 additions & 3 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,9 @@ const Supergood = () => {
stdTTL: 0
});

errorSinkUrl = `${baseUrl}${supergoodConfig.errorSinkEndpoint}`;
eventSinkUrl = `${baseUrl}${supergoodConfig.eventSinkEndpoint}`;

headerOptions = getHeaderOptions(clientId, clientSecret);
log = logger({ errorSinkUrl, headerOptions });

Expand Down Expand Up @@ -149,9 +152,6 @@ const Supergood = () => {
}
});

errorSinkUrl = `${baseUrl}${supergoodConfig.errorSinkEndpoint}`;
eventSinkUrl = `${baseUrl}${supergoodConfig.eventSinkEndpoint}`;

// Flushes the cache every <flushInterval> milliseconds
interval = setInterval(flushCache, supergoodConfig.flushInterval);
interval.unref();
Expand Down
1 change: 1 addition & 0 deletions src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ const logger = ({
JSON.stringify(payload, null, 2),
error
);
console.log({ reportOut, errorSinkUrl });
if (reportOut && errorSinkUrl) {
postError(
errorSinkUrl,
Expand Down

0 comments on commit 2e3b885

Please sign in to comment.