Skip to content

Can't use Infura IPFS with HTTP Basic Auth #3981

@endersonmaia

Description

@endersonmaia

graph-node fails when I define ipfs address using HTTP Basic Auth in the URL.

What is the current behavior?

Starting with graph-cli:0.33.0, I can add the --headers parameter to deploy a subgraph using Infura's IPFS.

npx graph deploy \
    --product hosted-service \
    --version-label v1.0.0 \
    --headers "{\"Authorization\": \"Basic bXlfdXNlcl9uYW1lOm15X3NlY3JldF9wYXNzd29yZA==\"}" \
    --ipfs https://ipfs.infura.io:5001 my-subgraph subgraph.yaml \
    --node http://localhost:8020

Configuring graph-node with --ipfs=https://bXlfdXNlcl9uYW1l:HIDDEN_PASSWORD@ipfs.infura.io:5001/

But when configuring the graph-node to use Infura's IPFS, I get errors.

Sep 22 19:52:34.954 INFO Graph Node version: 0.27.0 (2022-08-01)
Sep 22 19:52:34.954 WARN GRAPH_POI_ACCESS_TOKEN not set; might leak POIs to the public via GraphQL
Sep 22 19:52:34.954 INFO Reading configuration file `/graph-node/config.toml`
Sep 22 19:52:34.955 WARN No fork base URL specified, subgraph forking is disabled
Sep 22 19:52:34.955 INFO Starting up
Sep 22 19:52:34.955 INFO Trying IPFS node at: https://bXlfdXNlcl9uYW1l:HIDDEN_PASSWORD@ipfs.infura.io:5001/
Sep 22 19:52:34.972 INFO Creating transport, capabilities: , url: https://goerli.infura.io/v3/__REDACTED__, provider: goerli
Sep 22 19:52:35.011 INFO Successfully connected to IPFS node at: https://bXlfdXNlcl9uYW1l:HIDDEN_PASSWORD@ipfs.infura.io:5001/
Sep 22 19:52:35.018 INFO Creating transport, capabilities: , url: https://mainnet.infura.io/v3/__REDACTED__, provider: mainnet
Sep 22 19:52:35.084 INFO Connecting to Postgres, weight: 1, conn_pool_size: 10, url: postgresql://graph-node-indexer-rg6jmQ:HIDDEN_PASSWORD@__REDACTED__/graph-node, pool: main, shard: primary
...
Sep 22 20:07:30.219 INFO Received subgraph_deploy request, params: SubgraphDeployParams { name: SubgraphName("cartesi/pos-goerli"), ipfs_hash: DeploymentHash("QmYX691Wu75US7uEiEohQ18WgFiuRjaa8hqE3PqknJKoHR"), node_id: None, debug_fork: None }, component: JsonRpcServer
Sep 22 20:07:30.903 WARN Trying again after IPFS stat failed (attempt #10) with result Err(reqwest::Error { kind: Status(403), url: Url { scheme: "https", cannot_be_a_base: false, username: "", password: None, host: Some(Domain("ipfs.infura.io")), port: Some(5001), path: "/api/v0/files/stat", query: Some("arg=/ipfs/QmYX691Wu75US7uEiEohQ18WgFiuRjaa8hqE3PqknJKoHR"), fragment: None } }), sgd: 0, subgraph_id: QmYX691Wu75US7uEiEohQ18WgFiuRjaa8hqE3PqknJKoHR, component: SubgraphRegistrar
Sep 22 20:07:31.894 WARN Trying again after IPFS stat failed (attempt #11) with result Err(reqwest::Error { kind: Status(403), url: Url { scheme: "https", cannot_be_a_base: false, username: "", password: None, host: Some(Domain("ipfs.infura.io")), port: Some(5001), path: "/api/v0/files/stat", query: Some("arg=/ipfs/QmYX691Wu75US7uEiEohQ18WgFiuRjaa8hqE3PqknJKoHR"), fragment: None } }), sgd: 0, subgraph_id: QmYX691Wu75US7uEiEohQ18WgFiuRjaa8hqE3PqknJKoHR, component: SubgraphRegistrar
Sep 22 20:07:33.503 WARN Trying again after IPFS stat failed (attempt #12) with result Err(reqwest::Error { kind: Status(403), url: Url { scheme: "https", cannot_be_a_base: false, username: "", password: None, host: Some(Domain("ipfs.infura.io")), port: Some(5001), path: "/api/v0/files/stat", query: Some("arg=/ipfs/QmYX691Wu75US7uEiEohQ18WgFiuRjaa8hqE3PqknJKoHR"), fragment: None } }), sgd: 0, subgraph_id: QmYX691Wu75US7uEiEohQ18WgFiuRjaa8hqE3PqknJKoHR, component: SubgraphRegistrar

If the current behavior is a bug, please provide the steps to reproduce and if possible a minimal demo of the problem.

  • Create an Infura IPFS project
  • Configure grpah-node to point to it
  • Deploy the subgraph to it using graph-cli >=0.33.0 with --headers parameter
  • See graph-node logs

What is the expected behavior?

graph-node should be able to get Infura IPFS files

graph-node should support HTTP Basic Auth in the URL, like https://[user:pass@]host[:port]

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions