Uniswap front-end project fails to build schema.graphql

When uniswap builds the front-end project, that is, the interface, the following error occurs!

$ node fetch-schema.js
Failed to fetch schema from https://api.thegraph.com/subgraphs/name/uniswap/uniswap-v3
Failed to fetch schema from https://api.uniswap.org/v1/graphql
Done in 22.63s.
yarn run v1.22.19
$ yarn relay && yarn relay-thegraph
$ relay-compiler relay.config.js
[ERROR] Config `D:\workspace\gambo\interface\relay.config.js` is invalid:
 - The `schema` configured for project `default` does not exist at `./src/graphql/data/schema.graphql`.

It is observed that an error occurred when executing node fetch-schema.js, let's take a look at the code inside.

/* eslint-disable */
require('dotenv').config({ path: '.env.production' })
const { exec } = require('child_process')
const dataConfig = require('./relay.config')
const thegraphConfig = require('./relay_thegraph.config')
/* eslint-enable */

function fetchSchema(url, outputFile) {
  exec(
    `get-graphql-schema --h Origin=https://app.uniswap.org ${url} | tee ${outputFile}.temp`,
    (error, stdout, stderr) => {
      if (error || stderr) {
        console.log(`Failed to fetch schema from ${url}`)
      } else if (stdout) {
        exec(`mv ${outputFile}.temp ${outputFile}`)
      }
    }
  )
}

fetchSchema(process.env.THE_GRAPH_SCHEMA_ENDPOINT, thegraphConfig.schema)
fetchSchema(process.env.REACT_APP_AWS_API_ENDPOINT, dataConfig.schema)

The code is very simple, that is, download the configuration file of the graph from the addresses of THE_GRAPH_SCHEMA_ENDPOINT and REACT_APP_AWS_API_ENDPOINT through the get-graphql-schema command. Looking at the error message, it should be that the access was not successful.

Students who don't know the graph can take a look at this series .

REACT_APP_AWS_API_ENDPOINT="https://api.uniswap.org/v1/graphql"

THE_GRAPH_SCHEMA_ENDPOINT="https://api.thegraph.com/subgraphs/name/uniswap/uniswap-v3"

Let's first manually run the command to call the two URLs separately.

yarn get-graphql-schema --h Origin=https://app.uniswap.org https://api.uniswap.org/v1/graphql

yarn get-graphql-schema --h Origin=https://app.uniswap.org https://api.thegraph.com/subgraphs/name/uniswap/uniswap-v3

The first one fails on my side, the second one succeeds.

The error is as follows:

$ D:\workspace\gambo\interface\node_modules\.bin\get-graphql-schema https://api.uniswap.org/v1/graphql
FetchError: request to https://api.uniswap.org/v1/graphql failed, reason: connect ETIMEDOUT 199.59.150.44:443
    at ClientRequest.<anonymous> (D:\workspace\gambo\interface\node_modules\get-graphql-schema\node_modules\node-fetch\lib\index.js:1491:11)
    at ClientRequest.emit (events.js:400:28)
    at TLSSocket.socketErrorListener (_http_client.js:475:9)
    at TLSSocket.emit (events.js:400:28)
    at emitErrorNT (internal/streams/destroy.js:106:8)
    at emitErrorCloseNT (internal/streams/destroy.js:74:3)
    at processTicksAndRejections (internal/process/task_queues.js:82:21) {
  type: 'system',
  errno: 'ETIMEDOUT',
  code: 'ETIMEDOUT'
}

It seems that the address https://api.uniswap.org/v1/graphql cannot be accessed. At that time, someone had built the front-end project of uniswap, and there was no such problem. After multiple confirmations, it was finally found that it was a problem with the scientific Internet tool. I use pigcha here, and I need to use the global proxy mode.

Rebuild after checking, the problem is solved!

Supongo que te gusta

Origin blog.csdn.net/gambool/article/details/129426561
Recomendado
Clasificación