Skip to content

Commit 8190187

Browse files
authored
fix(client): use the default node fetch for gqlClient (#1551)
* fix: deployment * fix: deployment * fix: deployment * fix: versionning * fix: versionning * fix: versionning * fix: versionning * fix: versionning * fix: hasura * fix: hasura * fix: hasura * fix: hasura * fix: hasura * fix: code * fix: pretry * fix: pretry * fix: pretry
1 parent 0b5d7ec commit 8190187

File tree

13 files changed

+33
-86
lines changed

13 files changed

+33
-86
lines changed

.github/workflows/quality.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ jobs:
2020
- name: Set up Node
2121
uses: actions/setup-node@v3
2222
with:
23-
node-version: 20.3.1
23+
node-version: 22.13.1
2424
cache: "yarn"
2525
- name: Install dependencies
2626
env:
@@ -59,7 +59,7 @@ jobs:
5959
- name: Set up Node
6060
uses: actions/setup-node@v3
6161
with:
62-
node-version: 20.3.1
62+
node-version: 22.13.1
6363
cache: "yarn"
6464
- name: Lint ${{ matrix.repositories }}
6565
run: |
@@ -90,7 +90,7 @@ jobs:
9090
- name: Set up Node
9191
uses: actions/setup-node@v3
9292
with:
93-
node-version: 20.3.1
93+
node-version: 22.13.1
9494
cache: "yarn"
9595
- name: Type-check ${{ matrix.repositories }}
9696
run: |
@@ -121,7 +121,7 @@ jobs:
121121
- name: Set up Node
122122
uses: actions/setup-node@v3
123123
with:
124-
node-version: 20.3.1
124+
node-version: 22.13.1
125125
cache: "yarn"
126126
- name: Test ${{ matrix.repositories }}
127127
run: |

.github/workflows/release.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ concurrency:
77
group: release-${{ github.ref }}
88

99
permissions:
10-
id-token: write # Required for OIDC token generation
10+
id-token: write # Required for OIDC token generation
1111

1212
jobs:
1313
release:
@@ -30,7 +30,7 @@ jobs:
3030
- name: Set up Node
3131
uses: actions/setup-node@v3
3232
with:
33-
node-version: 20.3.1
33+
node-version: 22.13.1
3434
cache: "yarn"
3535
- name: Install dependencies
3636
env:

.node-version

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
20.3.1
1+
22.13.1

shared/utils/package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
"@socialgouv/dila-api-client": "^1.2.4",
88
"@urql/core": "5.1.0",
99
"graphql": "^16.8.1",
10-
"isomorphic-unfetch": "4.0.2",
1110
"uuid": "^9.0.1",
1211
"winston": "3.3.4",
1312
"xxhashjs": "^0.2.2"

shared/utils/src/gqlClient.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ import {
55
mapExchange,
66
gql as gqlHelper,
77
} from "@urql/core";
8-
import fetch from "isomorphic-unfetch";
98

109
type GqlClientParameter = {
1110
graphqlEndpoint: string;
@@ -31,6 +30,9 @@ export const gqlClient = (props = gqlDefaultProps) =>
3130
url: props.graphqlEndpoint,
3231
exchanges: [
3332
mapExchange({
33+
onError(error) {
34+
console.error("URQL ERROR :", JSON.stringify(error));
35+
},
3436
onResult(result) {
3537
return result.operation.kind === "query"
3638
? { ...result, data: maskTypename(result.data, true) }

shared/utils/tsconfig.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
"resolveJsonModule": true,
77
"skipLibCheck": true,
88
"strict": true,
9-
"lib": ["ESNext"],
9+
"lib": ["dom", "dom.iterable", "esnext"],
1010
"module": "CommonJS",
1111
"target": "ESNext",
1212
"declaration": true,

targets/alert-cli/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
ARG NODE_VERSION=20.3.1-alpine
1+
ARG NODE_VERSION=22.13.1-alpine
22

33
FROM node:$NODE_VERSION AS deps
44

targets/export-elasticsearch/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
ARG NODE_VERSION=20.3.1-alpine
1+
ARG NODE_VERSION=22.13.1-alpine
22

33
FROM node:$NODE_VERSION AS deps
44

targets/frontend/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
ARG NODE_VERSION=20.3.1-alpine
1+
ARG NODE_VERSION=22.13.1-alpine
22

33
FROM node:$NODE_VERSION AS deps
44

targets/hasura/Dockerfile

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,14 @@
1-
FROM hasura/graphql-engine:v2.37.0.cli-migrations-v3
1+
FROM hasura/graphql-engine:v2.45.1.cli-migrations-v3
22

33
# Used for the migration from v1 (https://hasura.io/docs/latest/guides/upgrade-hasura-v2/#hasura-v2-behaviour-changes)
44
# Need a full test of the admin before removed
55
ENV HASURA_GRAPHQL_V1_BOOLEAN_NULL_COLLAPSE=true
6-
6+
# Docs: https://hasura.io/docs/2.0/deployment/graphql-engine-flags/reference/
77
ENV HASURA_GRAPHQL_ENABLE_TELEMETRY=false
88
ENV HASURA_GRAPHQL_SERVER_PORT=8080
9+
ENV HASURA_GRAPHQL_LIVE_QUERIES_MULTIPLEXED_BATCH_SIZE=1000
10+
ENV HASURA_GRAPHQL_LIVE_QUERIES_MULTIPLEXED_REFETCH_INTERVAL=2000
11+
ENV HASURA_GRAPHQL_LOG_LEVEL=debug
912

1013
COPY ./migrations /hasura-migrations
1114
COPY ./metadata /hasura-metadata

targets/ingester/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
ARG NODE_VERSION=20.3.1-alpine
1+
ARG NODE_VERSION=22.13.1-alpine
22

33
FROM node:$NODE_VERSION AS deps
44

targets/ingester/src/cli.ts

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,19 @@ async function main() {
141141
console.timeEnd(` getDocuments ${pkgName}`);
142142
console.log(` ${pkgName}: ${documents.length} documents`);
143143
if (!args.dryRun && documents.length > 0) {
144-
await initDocAvailabity(documents[0].source);
144+
await pRetry(async () => await initDocAvailabity(documents[0].source), {
145+
onFailedAttempt: (error) => {
146+
console.error(
147+
`Init doc availability failed ${error.attemptNumber}/${
148+
error.retriesLeft + error.attemptNumber
149+
}`,
150+
error.name,
151+
error.message
152+
);
153+
},
154+
retries: 5,
155+
});
156+
145157
console.log(
146158
` ready to ingest ${documents.length} documents from ${pkgName}`
147159
);

yarn.lock

Lines changed: 0 additions & 69 deletions
Original file line numberDiff line numberDiff line change
@@ -4163,7 +4163,6 @@ __metadata:
41634163
"@types/xxhashjs": ^0.2.2
41644164
"@urql/core": 5.1.0
41654165
graphql: ^16.8.1
4166-
isomorphic-unfetch: 4.0.2
41674166
jest: ^29.7.0
41684167
typescript: ^5.4.3
41694168
uuid: ^9.0.1
@@ -9109,13 +9108,6 @@ __metadata:
91099108
languageName: node
91109109
linkType: hard
91119110

9112-
"data-uri-to-buffer@npm:^4.0.0":
9113-
version: 4.0.1
9114-
resolution: "data-uri-to-buffer@npm:4.0.1"
9115-
checksum: 0d0790b67ffec5302f204c2ccca4494f70b4e2d940fea3d36b09f0bb2b8539c2e86690429eb1f1dc4bcc9e4df0644193073e63d9ee48ac9fce79ec1506e4aa4c
9116-
languageName: node
9117-
linkType: hard
9118-
91199111
"data-urls@npm:^2.0.0":
91209112
version: 2.0.0
91219113
resolution: "data-urls@npm:2.0.0"
@@ -10746,16 +10738,6 @@ __metadata:
1074610738
languageName: node
1074710739
linkType: hard
1074810740

10749-
"fetch-blob@npm:^3.1.2, fetch-blob@npm:^3.1.4":
10750-
version: 3.2.0
10751-
resolution: "fetch-blob@npm:3.2.0"
10752-
dependencies:
10753-
node-domexception: ^1.0.0
10754-
web-streams-polyfill: ^3.0.3
10755-
checksum: f19bc28a2a0b9626e69fd7cf3a05798706db7f6c7548da657cbf5026a570945f5eeaedff52007ea35c8bcd3d237c58a20bf1543bc568ab2422411d762dd3d5bf
10756-
languageName: node
10757-
linkType: hard
10758-
1075910741
"figures@npm:3.2.0, figures@npm:^3.0.0":
1076010742
version: 3.2.0
1076110743
resolution: "figures@npm:3.2.0"
@@ -11023,15 +11005,6 @@ __metadata:
1102311005
languageName: node
1102411006
linkType: hard
1102511007

11026-
"formdata-polyfill@npm:^4.0.10":
11027-
version: 4.0.10
11028-
resolution: "formdata-polyfill@npm:4.0.10"
11029-
dependencies:
11030-
fetch-blob: ^3.1.2
11031-
checksum: 82a34df292afadd82b43d4a740ce387bc08541e0a534358425193017bf9fb3567875dc5f69564984b1da979979b70703aa73dee715a17b6c229752ae736dd9db
11032-
languageName: node
11033-
linkType: hard
11034-
1103511008
"formidable@npm:^2.0.0, formidable@npm:^2.1.2":
1103611009
version: 2.1.2
1103711010
resolution: "formidable@npm:2.1.2"
@@ -12914,16 +12887,6 @@ __metadata:
1291412887
languageName: node
1291512888
linkType: hard
1291612889

12917-
"isomorphic-unfetch@npm:4.0.2":
12918-
version: 4.0.2
12919-
resolution: "isomorphic-unfetch@npm:4.0.2"
12920-
dependencies:
12921-
node-fetch: ^3.2.0
12922-
unfetch: ^5.0.0
12923-
checksum: a5c22569f18a897c333aa2d7c0042214e1d26fc502b7b7dd451aca81f34a56557cb48faf63a3ad5c6534d610c043ef36b9e999211a2c0665eabdca9e9c86e398
12924-
languageName: node
12925-
linkType: hard
12926-
1292712890
"istanbul-lib-coverage@npm:^3.0.0, istanbul-lib-coverage@npm:^3.2.0":
1292812891
version: 3.2.0
1292912892
resolution: "istanbul-lib-coverage@npm:3.2.0"
@@ -15678,13 +15641,6 @@ __metadata:
1567815641
languageName: node
1567915642
linkType: hard
1568015643

15681-
"node-domexception@npm:^1.0.0":
15682-
version: 1.0.0
15683-
resolution: "node-domexception@npm:1.0.0"
15684-
checksum: ee1d37dd2a4eb26a8a92cd6b64dfc29caec72bff5e1ed9aba80c294f57a31ba4895a60fd48347cf17dd6e766da0ae87d75657dfd1f384ebfa60462c2283f5c7f
15685-
languageName: node
15686-
linkType: hard
15687-
1568815644
"node-fetch@npm:^2.6.1, node-fetch@npm:^2.6.5, node-fetch@npm:^2.6.6, node-fetch@npm:^2.6.7":
1568915645
version: 2.6.11
1569015646
resolution: "node-fetch@npm:2.6.11"
@@ -15699,17 +15655,6 @@ __metadata:
1569915655
languageName: node
1570015656
linkType: hard
1570115657

15702-
"node-fetch@npm:^3.2.0":
15703-
version: 3.3.2
15704-
resolution: "node-fetch@npm:3.3.2"
15705-
dependencies:
15706-
data-uri-to-buffer: ^4.0.0
15707-
fetch-blob: ^3.1.4
15708-
formdata-polyfill: ^4.0.10
15709-
checksum: 06a04095a2ddf05b0830a0d5302699704d59bda3102894ea64c7b9d4c865ecdff2d90fd042df7f5bc40337266961cb6183dcc808ea4f3000d024f422b462da92
15710-
languageName: node
15711-
linkType: hard
15712-
1571315658
"node-gyp-build@npm:^4.3.0":
1571415659
version: 4.6.0
1571515660
resolution: "node-gyp-build@npm:4.6.0"
@@ -20417,13 +20362,6 @@ __metadata:
2041720362
languageName: node
2041820363
linkType: hard
2041920364

20420-
"unfetch@npm:^5.0.0":
20421-
version: 5.0.0
20422-
resolution: "unfetch@npm:5.0.0"
20423-
checksum: 005133bcdc85cefea60890af4ac265799356b69c6a7719c1330484165af7109c06b9eedd3e03d620c14dcc8b43bcf329148f4c1f06016390162f845e0d0a62c5
20424-
languageName: node
20425-
linkType: hard
20426-
2042720365
"unique-filename@npm:^2.0.0":
2042820366
version: 2.0.1
2042920367
resolution: "unique-filename@npm:2.0.1"
@@ -20869,13 +20807,6 @@ __metadata:
2086920807
languageName: node
2087020808
linkType: hard
2087120809

20872-
"web-streams-polyfill@npm:^3.0.3":
20873-
version: 3.3.3
20874-
resolution: "web-streams-polyfill@npm:3.3.3"
20875-
checksum: 21ab5ea08a730a2ef8023736afe16713b4f2023ec1c7085c16c8e293ee17ed085dff63a0ad8722da30c99c4ccbd4ccd1b2e79c861829f7ef2963d7de7004c2cb
20876-
languageName: node
20877-
linkType: hard
20878-
2087920810
"webidl-conversions@npm:^3.0.0":
2088020811
version: 3.0.1
2088120812
resolution: "webidl-conversions@npm:3.0.1"

0 commit comments

Comments
 (0)