question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Having issues with Cloudflare endpoints

See original GitHub issue

Given an example:

import {ethers, providers } from 'ethers';

const provider = new providers.JsonRpcProvider("https://cloudflare-eth.com")

var privateKey = '0x00000000000000000000000000000000000000000000000000000000000000d0';
var wallet = new ethers.Wallet(privateKey,provider);

const contract = new ethers.Contract(
  '0xD1E5b0FF1287aA9f9A268759062E4Ab08b9Dacbe',
  [
    {
      constant: true,
      inputs: [
        {
          name: 'tokenId',
          type: 'uint256',
        },
      ],
      name: 'ownerOf',
      outputs: [
        {
          name: '',
          type: 'address',
        },
      ],
      payable: false,
      stateMutability: 'view',
      type: 'function',
    },
  ],
  wallet,
)

contract.functions.ownerOf(
  '0x6d8b296e38dfd295f2f4feb9ef2721c48210b7d77c0a08867123d9bd5150cf47'
).then(console.log, console.log)

Produces:

Error: processing response error (body={"jsonrpc":"2.0","id":46,"error":{"code":3,"message":"execution reverted: ERC721: owner query for nonexistent token","data":"0x08c379a0000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000294552433732313a206f776e657220717565727920666f72206e6f6e6578697374656e7420746f6b656e0000000000000000000000000000000000000000000000"}}, error={"code":3,"data":"0x08c379a0000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000294552433732313a206f776e657220717565727920666f72206e6f6e6578697374656e7420746f6b656e0000000000000000000000000000000000000000000000"}, requestBody="{\"method\":\"eth_call\",\"params\":[{\"from\":\"0x379ff6375f4a44f458683629ef05141d73fae55a\",\"to\":\"0xd1e5b0ff1287aa9f9a268759062e4ab08b9dacbe\",\"data\":\"0x6352211e6d8b296e38dfd295f2f4feb9ef2721c48210b7d77c0a08867123d9bd5150cf47\"},\"latest\"],\"id\":46,\"jsonrpc\":\"2.0\"}", requestMethod="POST", url="https://cloudflare-eth.com", code=SERVER_ERROR, version=web/5.0.1)
    at Logger.makeError (/Users/bogdan/makabu/unstoppable/resolution/node_modules/@ethersproject/logger/lib/index.js:179:21)
    at Logger.throwError (/Users/bogdan/makabu/unstoppable/resolution/node_modules/@ethersproject/logger/lib/index.js:188:20)
    at /Users/bogdan/makabu/unstoppable/resolution/node_modules/@ethersproject/web/lib/index.js:192:32
    at step (/Users/bogdan/makabu/unstoppable/resolution/node_modules/@ethersproject/web/lib/index.js:33:23)
    at Object.next (/Users/bogdan/makabu/unstoppable/resolution/node_modules/@ethersproject/web/lib/index.js:14:53)
    at fulfilled (/Users/bogdan/makabu/unstoppable/resolution/node_modules/@ethersproject/web/lib/index.js:5:58)
    at processTicksAndRejections (internal/process/task_queues.js:93:5) {
  reason: 'processing response error',
  code: 'SERVER_ERROR',
  body: {
    jsonrpc: '2.0',
    id: 46,
    error: {
      code: 3,
      message: 'execution reverted: ERC721: owner query for nonexistent token',
      data: '0x08c379a0000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000294552433732313a206f776e657220717565727920666f72206e6f6e6578697374656e7420746f6b656e0000000000000000000000000000000000000000000000'
    }
  },
  error: Error: execution reverted: ERC721: owner query for nonexistent token
      at getResult (/Users/bogdan/makabu/unstoppable/resolution/node_modules/@ethersproject/providers/lib/json-rpc-provider.js:70:21)
      at /Users/bogdan/makabu/unstoppable/resolution/node_modules/@ethersproject/web/lib/index.js:186:46
      at step (/Users/bogdan/makabu/unstoppable/resolution/node_modules/@ethersproject/web/lib/index.js:33:23)
      at Object.next (/Users/bogdan/makabu/unstoppable/resolution/node_modules/@ethersproject/web/lib/index.js:14:53)
      at fulfilled (/Users/bogdan/makabu/unstoppable/resolution/node_modules/@ethersproject/web/lib/index.js:5:58)
      at processTicksAndRejections (internal/process/task_queues.js:93:5) {
    code: 3,
    data: '0x08c379a0000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000294552433732313a206f776e657220717565727920666f72206e6f6e6578697374656e7420746f6b656e0000000000000000000000000000000000000000000000'
  },
  requestBody: '{"method":"eth_call","params":[{"from":"0x379ff6375f4a44f458683629ef05141d73fae55a","to":"0xd1e5b0ff1287aa9f9a268759062e4ab08b9dacbe","data":"0x6352211e6d8b296e38dfd295f2f4feb9ef2721c48210b7d77c0a08867123d9bd5150cf47"},"latest"],"id":46,"jsonrpc":"2.0"}',
  requestMethod: 'POST',
  url: 'https://cloudflare-eth.com'
}

It is interesting that the same call to mainnet.infura.io doesn’t produce such error.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:12 (7 by maintainers)

github_iconTop GitHub Comments

1reaction
ricmoocommented, Nov 24, 2020

It looks like LinkPool (I’ve not heard of that one before) doesn’t return any of the needed data to recreate the actual correct revert data returned, so I don’t think there is anything that can be done for that… 😒

Glad it works for Geth though. I’ll close this issue.

Thanks! 😃

1reaction
zemsecommented, Jul 13, 2020

@bogdan Can you try with this request: {"jsonrpc":"2.0","method":"eth_blockNumber","params":[],"id":83} or provider.getBlockNumber() and check if you are getting latest block numbers on cloudfare like infura as @ricmoo has suggested?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Troubleshooting Cloudflare 5XX errors
Diagnose and resolve 5XX errors for Cloudflare proxied sites. Overview Error analytics Error 500: internal server error Error 502 bad...
Read more >
CloudFlare not available: Failed to reach API endpoint
This could be due to a simple internet connection issue, or maybe the server is offline. This connectivity issue, which usually resolves itself...
Read more >
Cloudflare Status
Resolved - Cloudflare has resolved the issue and services have resumed normal operation. For the time period of 2022-12-21 14:00 UTC to 2022-12-21...
Read more >
SOAP: Unable to access external endpoint using Cloudflare
Resolution: Notify the website owner of the blocking. If you cannot determine how to contact the website owner, look up contact information for...
Read more >
Troubleshoot access issues with Cloudflare WARP
The following can cause this issue: Gateway may have blocked these sites as WARP works with Cloudflare Gateway to block websites that are...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found