Skip to content

Commit 631352d

Browse files
committed
Switch from pinejs-client-request to pinejs-client-fetch
Change-type: patch
1 parent 0d37c9e commit 631352d

4 files changed

Lines changed: 23 additions & 20 deletions

File tree

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
@@ -36,7 +36,7 @@
3636
"netmask": "^2.0.2",
3737
"node-tunnel": "^4.0.1",
3838
"p-timeout": "^6.1.4",
39-
"pinejs-client-request": "^8.0.1",
39+
"pinejs-client-fetch": "^2.0.1",
4040
"request": "^2.88.2",
4141
"request-promise": "^4.2.6",
4242
"telnet-client": "^1.4.11",

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');
@@ -120,7 +120,7 @@ export const getDeviceVpnHost = async (
120120
});
121121
return services[0];
122122
} catch (err) {
123-
if (!(err instanceof StatusError) || err.statusCode !== 401) {
123+
if (!(err instanceof RequestError) || err.status !== 401) {
124124
// Do not capture `Unauthorized` errors
125125
captureException(err, 'device-vpn-host-lookup-error');
126126
}

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)