Skip to content

Commit 27e725b

Browse files
committed
Merge branch 'main' of github.com:HubSpot/hubspot-local-dev-lib into next
2 parents a252d4e + ec80022 commit 27e725b

File tree

3 files changed

+12
-16
lines changed

3 files changed

+12
-16
lines changed

lang/en.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
"trackUsage": {
44
"invalidEvent": "Usage tracking event {{ eventName }} is not a valid event type.",
55
"sendingEventAuthenticated": "Sending usage event to authenticated endpoint",
6+
"retryingEventUnauthenticated": "Failed to send the usage event as authenticated. Trying again as unauthenticated.",
67
"sendingEventUnauthenticated": "Sending usage event to unauthenticated endpoint"
78
},
89
"archive": {

lib/trackUsage.ts

Lines changed: 10 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -44,21 +44,16 @@ export async function trackUsage(
4444

4545
if (accountConfig && accountConfig.authType === 'personalaccesskey') {
4646
logger.debug(i18n(`${i18nKey}.sendingEventAuthenticated`));
47-
await http.post(accountId, {
48-
url: `${path}/authenticated`,
49-
data: usageEvent,
50-
resolveWithFullResponse: true,
51-
});
52-
} else {
53-
const env = getEnv(accountId);
54-
const axiosConfig = getAxiosConfig({
55-
env,
56-
url: path,
57-
data: usageEvent,
58-
resolveWithFullResponse: true,
59-
});
60-
logger.debug(i18n(`${i18nKey}.sendingEventUnauthenticated`));
61-
axios({ ...axiosConfig, method: 'post' });
47+
try {
48+
const result: void = await http.post(accountId, {
49+
url: `${path}/authenticated`,
50+
data: usageEvent,
51+
resolveWithFullResponse: true,
52+
});
53+
return result;
54+
} catch (e) {
55+
logger.debug(i18n(`${i18nKey}.retryingEventUnauthenticated`));
56+
}
6257
}
6358

6459
const env = getEnv(accountId);

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@hubspot/local-dev-lib",
3-
"version": "1.13.0",
3+
"version": "1.13.1",
44
"description": "Provides library functionality for HubSpot local development tooling, including the HubSpot CLI",
55
"main": "lib/index.js",
66
"repository": {

0 commit comments

Comments
 (0)