Skip to content

Commit

Permalink
fix(client): use the default node fetch for gqlClient (#1551)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
maxgfr authored Feb 6, 2025
1 parent 0b5d7ec commit 8190187
Show file tree
Hide file tree
Showing 13 changed files with 33 additions and 86 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/quality.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
- name: Set up Node
uses: actions/setup-node@v3
with:
node-version: 20.3.1
node-version: 22.13.1
cache: "yarn"
- name: Install dependencies
env:
Expand Down Expand Up @@ -59,7 +59,7 @@ jobs:
- name: Set up Node
uses: actions/setup-node@v3
with:
node-version: 20.3.1
node-version: 22.13.1
cache: "yarn"
- name: Lint ${{ matrix.repositories }}
run: |
Expand Down Expand Up @@ -90,7 +90,7 @@ jobs:
- name: Set up Node
uses: actions/setup-node@v3
with:
node-version: 20.3.1
node-version: 22.13.1
cache: "yarn"
- name: Type-check ${{ matrix.repositories }}
run: |
Expand Down Expand Up @@ -121,7 +121,7 @@ jobs:
- name: Set up Node
uses: actions/setup-node@v3
with:
node-version: 20.3.1
node-version: 22.13.1
cache: "yarn"
- name: Test ${{ matrix.repositories }}
run: |
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ concurrency:
group: release-${{ github.ref }}

permissions:
id-token: write # Required for OIDC token generation
id-token: write # Required for OIDC token generation

jobs:
release:
Expand All @@ -30,7 +30,7 @@ jobs:
- name: Set up Node
uses: actions/setup-node@v3
with:
node-version: 20.3.1
node-version: 22.13.1
cache: "yarn"
- name: Install dependencies
env:
Expand Down
2 changes: 1 addition & 1 deletion .node-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
20.3.1
22.13.1
1 change: 0 additions & 1 deletion shared/utils/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
"@socialgouv/dila-api-client": "^1.2.4",
"@urql/core": "5.1.0",
"graphql": "^16.8.1",
"isomorphic-unfetch": "4.0.2",
"uuid": "^9.0.1",
"winston": "3.3.4",
"xxhashjs": "^0.2.2"
Expand Down
4 changes: 3 additions & 1 deletion shared/utils/src/gqlClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import {
mapExchange,
gql as gqlHelper,
} from "@urql/core";
import fetch from "isomorphic-unfetch";

type GqlClientParameter = {
graphqlEndpoint: string;
Expand All @@ -31,6 +30,9 @@ export const gqlClient = (props = gqlDefaultProps) =>
url: props.graphqlEndpoint,
exchanges: [
mapExchange({
onError(error) {
console.error("URQL ERROR :", JSON.stringify(error));
},
onResult(result) {
return result.operation.kind === "query"
? { ...result, data: maskTypename(result.data, true) }
Expand Down
2 changes: 1 addition & 1 deletion shared/utils/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"resolveJsonModule": true,
"skipLibCheck": true,
"strict": true,
"lib": ["ESNext"],
"lib": ["dom", "dom.iterable", "esnext"],
"module": "CommonJS",
"target": "ESNext",
"declaration": true,
Expand Down
2 changes: 1 addition & 1 deletion targets/alert-cli/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
ARG NODE_VERSION=20.3.1-alpine
ARG NODE_VERSION=22.13.1-alpine

FROM node:$NODE_VERSION AS deps

Check failure on line 3 in targets/alert-cli/Dockerfile

View workflow job for this annotation

GitHub Actions / Lint Dockerfile

DL3026 error: Use only an allowed registry in the FROM image

Expand Down
2 changes: 1 addition & 1 deletion targets/export-elasticsearch/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
ARG NODE_VERSION=20.3.1-alpine
ARG NODE_VERSION=22.13.1-alpine

FROM node:$NODE_VERSION AS deps

Check failure on line 3 in targets/export-elasticsearch/Dockerfile

View workflow job for this annotation

GitHub Actions / Lint Dockerfile

DL3026 error: Use only an allowed registry in the FROM image

Expand Down
2 changes: 1 addition & 1 deletion targets/frontend/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
ARG NODE_VERSION=20.3.1-alpine
ARG NODE_VERSION=22.13.1-alpine

FROM node:$NODE_VERSION AS deps

Check failure on line 3 in targets/frontend/Dockerfile

View workflow job for this annotation

GitHub Actions / Lint Dockerfile

DL3026 error: Use only an allowed registry in the FROM image

Expand Down
7 changes: 5 additions & 2 deletions targets/hasura/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
FROM hasura/graphql-engine:v2.37.0.cli-migrations-v3
FROM hasura/graphql-engine:v2.45.1.cli-migrations-v3

Check failure on line 1 in targets/hasura/Dockerfile

View workflow job for this annotation

GitHub Actions / Lint Dockerfile

DL3026 error: Use only an allowed registry in the FROM image

# Used for the migration from v1 (https://hasura.io/docs/latest/guides/upgrade-hasura-v2/#hasura-v2-behaviour-changes)
# Need a full test of the admin before removed
ENV HASURA_GRAPHQL_V1_BOOLEAN_NULL_COLLAPSE=true

# Docs: https://hasura.io/docs/2.0/deployment/graphql-engine-flags/reference/
ENV HASURA_GRAPHQL_ENABLE_TELEMETRY=false
ENV HASURA_GRAPHQL_SERVER_PORT=8080
ENV HASURA_GRAPHQL_LIVE_QUERIES_MULTIPLEXED_BATCH_SIZE=1000
ENV HASURA_GRAPHQL_LIVE_QUERIES_MULTIPLEXED_REFETCH_INTERVAL=2000
ENV HASURA_GRAPHQL_LOG_LEVEL=debug

COPY ./migrations /hasura-migrations
COPY ./metadata /hasura-metadata
Expand Down
2 changes: 1 addition & 1 deletion targets/ingester/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
ARG NODE_VERSION=20.3.1-alpine
ARG NODE_VERSION=22.13.1-alpine

FROM node:$NODE_VERSION AS deps

Expand Down
14 changes: 13 additions & 1 deletion targets/ingester/src/cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,19 @@ async function main() {
console.timeEnd(` getDocuments ${pkgName}`);
console.log(` ${pkgName}: ${documents.length} documents`);
if (!args.dryRun && documents.length > 0) {
await initDocAvailabity(documents[0].source);
await pRetry(async () => await initDocAvailabity(documents[0].source), {
onFailedAttempt: (error) => {
console.error(
`Init doc availability failed ${error.attemptNumber}/${
error.retriesLeft + error.attemptNumber
}`,
error.name,
error.message
);
},
retries: 5,
});

console.log(
` ready to ingest ${documents.length} documents from ${pkgName}`
);
Expand Down
69 changes: 0 additions & 69 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -4163,7 +4163,6 @@ __metadata:
"@types/xxhashjs": ^0.2.2
"@urql/core": 5.1.0
graphql: ^16.8.1
isomorphic-unfetch: 4.0.2
jest: ^29.7.0
typescript: ^5.4.3
uuid: ^9.0.1
Expand Down Expand Up @@ -9109,13 +9108,6 @@ __metadata:
languageName: node
linkType: hard

"data-uri-to-buffer@npm:^4.0.0":
version: 4.0.1
resolution: "data-uri-to-buffer@npm:4.0.1"
checksum: 0d0790b67ffec5302f204c2ccca4494f70b4e2d940fea3d36b09f0bb2b8539c2e86690429eb1f1dc4bcc9e4df0644193073e63d9ee48ac9fce79ec1506e4aa4c
languageName: node
linkType: hard

"data-urls@npm:^2.0.0":
version: 2.0.0
resolution: "data-urls@npm:2.0.0"
Expand Down Expand Up @@ -10746,16 +10738,6 @@ __metadata:
languageName: node
linkType: hard

"fetch-blob@npm:^3.1.2, fetch-blob@npm:^3.1.4":
version: 3.2.0
resolution: "fetch-blob@npm:3.2.0"
dependencies:
node-domexception: ^1.0.0
web-streams-polyfill: ^3.0.3
checksum: f19bc28a2a0b9626e69fd7cf3a05798706db7f6c7548da657cbf5026a570945f5eeaedff52007ea35c8bcd3d237c58a20bf1543bc568ab2422411d762dd3d5bf
languageName: node
linkType: hard

"figures@npm:3.2.0, figures@npm:^3.0.0":
version: 3.2.0
resolution: "figures@npm:3.2.0"
Expand Down Expand Up @@ -11023,15 +11005,6 @@ __metadata:
languageName: node
linkType: hard

"formdata-polyfill@npm:^4.0.10":
version: 4.0.10
resolution: "formdata-polyfill@npm:4.0.10"
dependencies:
fetch-blob: ^3.1.2
checksum: 82a34df292afadd82b43d4a740ce387bc08541e0a534358425193017bf9fb3567875dc5f69564984b1da979979b70703aa73dee715a17b6c229752ae736dd9db
languageName: node
linkType: hard

"formidable@npm:^2.0.0, formidable@npm:^2.1.2":
version: 2.1.2
resolution: "formidable@npm:2.1.2"
Expand Down Expand Up @@ -12914,16 +12887,6 @@ __metadata:
languageName: node
linkType: hard

"isomorphic-unfetch@npm:4.0.2":
version: 4.0.2
resolution: "isomorphic-unfetch@npm:4.0.2"
dependencies:
node-fetch: ^3.2.0
unfetch: ^5.0.0
checksum: a5c22569f18a897c333aa2d7c0042214e1d26fc502b7b7dd451aca81f34a56557cb48faf63a3ad5c6534d610c043ef36b9e999211a2c0665eabdca9e9c86e398
languageName: node
linkType: hard

"istanbul-lib-coverage@npm:^3.0.0, istanbul-lib-coverage@npm:^3.2.0":
version: 3.2.0
resolution: "istanbul-lib-coverage@npm:3.2.0"
Expand Down Expand Up @@ -15678,13 +15641,6 @@ __metadata:
languageName: node
linkType: hard

"node-domexception@npm:^1.0.0":
version: 1.0.0
resolution: "node-domexception@npm:1.0.0"
checksum: ee1d37dd2a4eb26a8a92cd6b64dfc29caec72bff5e1ed9aba80c294f57a31ba4895a60fd48347cf17dd6e766da0ae87d75657dfd1f384ebfa60462c2283f5c7f
languageName: node
linkType: hard

"node-fetch@npm:^2.6.1, node-fetch@npm:^2.6.5, node-fetch@npm:^2.6.6, node-fetch@npm:^2.6.7":
version: 2.6.11
resolution: "node-fetch@npm:2.6.11"
Expand All @@ -15699,17 +15655,6 @@ __metadata:
languageName: node
linkType: hard

"node-fetch@npm:^3.2.0":
version: 3.3.2
resolution: "node-fetch@npm:3.3.2"
dependencies:
data-uri-to-buffer: ^4.0.0
fetch-blob: ^3.1.4
formdata-polyfill: ^4.0.10
checksum: 06a04095a2ddf05b0830a0d5302699704d59bda3102894ea64c7b9d4c865ecdff2d90fd042df7f5bc40337266961cb6183dcc808ea4f3000d024f422b462da92
languageName: node
linkType: hard

"node-gyp-build@npm:^4.3.0":
version: 4.6.0
resolution: "node-gyp-build@npm:4.6.0"
Expand Down Expand Up @@ -20417,13 +20362,6 @@ __metadata:
languageName: node
linkType: hard

"unfetch@npm:^5.0.0":
version: 5.0.0
resolution: "unfetch@npm:5.0.0"
checksum: 005133bcdc85cefea60890af4ac265799356b69c6a7719c1330484165af7109c06b9eedd3e03d620c14dcc8b43bcf329148f4c1f06016390162f845e0d0a62c5
languageName: node
linkType: hard

"unique-filename@npm:^2.0.0":
version: 2.0.1
resolution: "unique-filename@npm:2.0.1"
Expand Down Expand Up @@ -20869,13 +20807,6 @@ __metadata:
languageName: node
linkType: hard

"web-streams-polyfill@npm:^3.0.3":
version: 3.3.3
resolution: "web-streams-polyfill@npm:3.3.3"
checksum: 21ab5ea08a730a2ef8023736afe16713b4f2023ec1c7085c16c8e293ee17ed085dff63a0ad8722da30c99c4ccbd4ccd1b2e79c861829f7ef2963d7de7004c2cb
languageName: node
linkType: hard

"webidl-conversions@npm:^3.0.0":
version: 3.0.1
resolution: "webidl-conversions@npm:3.0.1"
Expand Down

0 comments on commit 8190187

Please sign in to comment.