Skip to content

Commit aaaae67

Browse files
committed
Switch from pinejs-client-request to pinejs-client-fetch
Change-type: patch
1 parent f60b871 commit aaaae67

File tree

4 files changed

+23
-20
lines changed

4 files changed

+23
-20
lines changed

package-lock.json

Lines changed: 17 additions & 14 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535
"netmask": "^2.0.2",
3636
"node-tunnel": "^4.0.8",
3737
"p-timeout": "^7.0.0",
38-
"pinejs-client-request": "^8.1.0",
38+
"pinejs-client-fetch": "^2.0.4",
3939
"request": "^2.88.2",
4040
"request-promise": "^4.2.6",
4141
"split": "^1.0.1",

src/utils/device.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
import { optionalVar } from '@balena/env-parsing';
1919
import memoize from 'memoizee';
2020

21-
import { balenaApi, getPassthrough, StatusError } from './index.js';
21+
import { balenaApi, getPassthrough, RequestError } from './index.js';
2222
import { APIError, captureException } from './errors.js';
2323

2424
const VPN_GUEST_API_KEY = optionalVar('VPN_GUEST_API_KEY');
@@ -123,7 +123,7 @@ export const getDeviceVpnHost = async (
123123
});
124124
return services[0];
125125
} catch (err) {
126-
if (!(err instanceof StatusError) || err.statusCode !== 401) {
126+
if (!(err instanceof RequestError) || err.status !== 401) {
127127
// Do not capture `Unauthorized` errors
128128
captureException(err, 'device-vpn-host-lookup-error');
129129
}

src/utils/index.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,16 +17,16 @@
1717

1818
import winston from 'winston';
1919

20-
import { PinejsClientRequest } from 'pinejs-client-request';
21-
export { StatusError } from 'pinejs-client-request';
20+
import PinejsClientFetch from 'pinejs-client-fetch';
21+
export { RequestError } from 'pinejs-client-fetch';
2222
import { BALENA_API_INTERNAL_HOST } from './config.js';
2323
import type { PineClient as BalenaPineClient } from 'balena-sdk';
2424

2525
import packageJSON from '../../package.json' with { type: 'json' };
2626
import { context, propagation } from '@opentelemetry/api';
2727
export const VERSION = packageJSON.version;
2828

29-
export const balenaApi = new PinejsClientRequest({
29+
export const balenaApi = new PinejsClientFetch({
3030
apiPrefix: `${BALENA_API_INTERNAL_HOST}/v7/`,
3131
}) satisfies BalenaPineClient as BalenaPineClient;
3232

0 commit comments

Comments
 (0)