Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CORS error while making graphql request to mina node #83

Open
0xMimir opened this issue Feb 2, 2024 · 0 comments
Open

CORS error while making graphql request to mina node #83

0xMimir opened this issue Feb 2, 2024 · 0 comments

Comments

@0xMimir
Copy link

0xMimir commented Feb 2, 2024

I have frontend setup with local node, this is my src/environments/environment.ts:

import { MinaEnv } from '@shared/types/core/environment/mina-env.type';

export const environment: Readonly<MinaEnv> = {
  production: false,
  isVanilla: false,
  identifier: 'Local Network',
  globalConfig: {
    features: {
      dashboard: ['nodes', 'topology'],
      explorer: ['blocks', 'transactions', 'snark-pool', 'scan-state', 'snark-traces'],
      resources: ['system'],
      network: ['messages', 'connections', 'blocks', 'blocks-ipc'],
      tracing: ['overview', 'blocks'],
      benchmarks: ['wallets', 'transactions'],
      storage: ['accounts'],
      'snark-worker': ['dashboard', 'actions'],
      'web-node': ['wallet', 'peers', 'logs', 'state'],
    },
  },
  configs: [
    {
      name: 'local',
      graphql: 'http://localhost:3085',
      debugger: 'http://localhost:8000',
    }
  ],
};

After it start query to check latest height fails with CORS ERROR

I can query the node from it's graphql interface at http://localhost:3085/graphql so I don't think it is something with ocaml node. In network tab there is not Response or Response headers on this request. This is how request looks when copied as fetch

fetch("http://localhost:3085/graphql", {
  "headers": {
    "accept": "application/json, text/plain, */*",
    "content-type": "application/json",
    "sec-ch-ua": "\"Not_A Brand\";v=\"8\", \"Chromium\";v=\"120\", \"Brave\";v=\"120\"",
    "sec-ch-ua-mobile": "?0",
    "sec-ch-ua-platform": "\"Linux\""
  },
  "referrer": "http://localhost:4200/",
  "referrerPolicy": "strict-origin-when-cross-origin",
  "body": "{\"query\":\"\\n  query latestBlockHeight {\\n    bestChain(maxLength: 1) {\\n      protocolState {\\n        consensusState {\\n          slotSinceGenesis\\n        }\\n      }\\n    }\\n  }\\n\"}",
  "method": "POST",
  "mode": "cors",
  "credentials": "omit"
});

When this is ran in browser I get following error:

zone.js:1519 Uncaught TypeError: Failed to fetch
    at zone.js:1518:36
    at proto.<computed> (zone.js:973:24)
    at <anonymous>:1:7

Mina node has commit: bfd1009abdbee78979ff0343cc73a3480e862f58

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant