@faable/faable 1.24.0 → 1.24.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/api/FaableApi.js
CHANGED
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
import { create_base_client } from './base_client.js';
|
|
2
2
|
|
|
3
|
+
// Socket-level failures where no response ever arrived: the connection died
|
|
4
|
+
// before the server produced anything, so a single retry is safe for any
|
|
5
|
+
// method (a reset mid-flight means the request was not processed).
|
|
6
|
+
const RESET_CODES = new Set(["ECONNRESET", "EPIPE"]);
|
|
7
|
+
const RETRY_DELAY_MS = 300;
|
|
8
|
+
const is_connection_reset = (e) => e.isAxiosError &&
|
|
9
|
+
!e.response &&
|
|
10
|
+
(RESET_CODES.has(e.code ?? "") || e.message.includes("socket hang up"));
|
|
3
11
|
const firstPage = async (res) => {
|
|
4
12
|
const items = (await res).results;
|
|
5
13
|
return items;
|
|
@@ -27,6 +35,20 @@ class FaableApi {
|
|
|
27
35
|
// Do something with request error
|
|
28
36
|
return Promise.reject(error);
|
|
29
37
|
});
|
|
38
|
+
// Registered before the error-wrapping interceptor so it sees the raw
|
|
39
|
+
// axios error. Retries once per request; the retried call re-enters the
|
|
40
|
+
// full chain (auth headers included).
|
|
41
|
+
const client = this.client;
|
|
42
|
+
this.client.interceptors.response.use(undefined, async (error) => {
|
|
43
|
+
const e = error;
|
|
44
|
+
const config = e.config;
|
|
45
|
+
if (config && !config._retried && is_connection_reset(e)) {
|
|
46
|
+
config._retried = true;
|
|
47
|
+
await new Promise((r) => setTimeout(r, RETRY_DELAY_MS));
|
|
48
|
+
return client.request(config);
|
|
49
|
+
}
|
|
50
|
+
throw error;
|
|
51
|
+
});
|
|
30
52
|
this.client.interceptors.response.use((response) => response, (error) => {
|
|
31
53
|
const e = error;
|
|
32
54
|
if (e.isAxiosError) {
|
|
@@ -22,14 +22,14 @@ const exchangeGithubOidcToken = async (gh_token, target_app_id) => {
|
|
|
22
22
|
// actionable next step.
|
|
23
23
|
if (status === 404) {
|
|
24
24
|
throw new Error('No app linked to this repository. Run "faable link" locally to link it, ' +
|
|
25
|
-
"or link it from the dashboard (https://dashboard.faable.com).");
|
|
25
|
+
"or link it from the dashboard (https://dashboard.faable.com).", { cause: err });
|
|
26
26
|
}
|
|
27
27
|
// Monorepo: several apps are linked to the same repository.
|
|
28
28
|
if (status === 400) {
|
|
29
29
|
throw new Error(serverMessage ||
|
|
30
|
-
"This repository has multiple linked apps. Specify which one with `faable deploy <app_id>`.");
|
|
30
|
+
"This repository has multiple linked apps. Specify which one with `faable deploy <app_id>`.", { cause: err });
|
|
31
31
|
}
|
|
32
|
-
throw new Error(`Faable OIDC token exchange failed (${status ?? "network error"})${serverMessage ? `: ${serverMessage}` : ""}
|
|
32
|
+
throw new Error(`Faable OIDC token exchange failed (${status ?? "network error"})${serverMessage ? `: ${serverMessage}` : ""}`, { cause: err });
|
|
33
33
|
}
|
|
34
34
|
throw err;
|
|
35
35
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@faable/faable",
|
|
3
|
-
"version": "1.24.
|
|
3
|
+
"version": "1.24.1",
|
|
4
4
|
"main": "dist/index.js",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "Marc Pomar <marc@faable.com>",
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
],
|
|
28
28
|
"dependencies": {
|
|
29
29
|
"@actions/core": "^3.0.0",
|
|
30
|
-
"axios": "^1.
|
|
30
|
+
"axios": "^1.18.1",
|
|
31
31
|
"fs-extra": "^11.3.2",
|
|
32
32
|
"handlebars": "^4.7.8",
|
|
33
33
|
"open": "^11.0.0",
|