diff --git a/src/constants.ts b/src/constants.ts index a2e266f..48fdffb 100644 --- a/src/constants.ts +++ b/src/constants.ts @@ -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'; diff --git a/src/index.ts b/src/index.ts index 92a1f7b..de04802 100644 --- a/src/index.ts +++ b/src/index.ts @@ -83,6 +83,9 @@ const Supergood = () => { stdTTL: 0 }); + errorSinkUrl = `${baseUrl}${supergoodConfig.errorSinkEndpoint}`; + eventSinkUrl = `${baseUrl}${supergoodConfig.eventSinkEndpoint}`; + headerOptions = getHeaderOptions(clientId, clientSecret); log = logger({ errorSinkUrl, headerOptions }); @@ -149,9 +152,6 @@ const Supergood = () => { } }); - errorSinkUrl = `${baseUrl}${supergoodConfig.errorSinkEndpoint}`; - eventSinkUrl = `${baseUrl}${supergoodConfig.eventSinkEndpoint}`; - // Flushes the cache every milliseconds interval = setInterval(flushCache, supergoodConfig.flushInterval); interval.unref(); diff --git a/src/utils.ts b/src/utils.ts index abd8949..a4731fa 100644 --- a/src/utils.ts +++ b/src/utils.ts @@ -38,6 +38,7 @@ const logger = ({ JSON.stringify(payload, null, 2), error ); + console.log({ reportOut, errorSinkUrl }); if (reportOut && errorSinkUrl) { postError( errorSinkUrl,