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

CCIP Read Error: unsupported protocol data #3341

Closed
eth-limo opened this issue Sep 9, 2022 · 5 comments
Closed

CCIP Read Error: unsupported protocol data #3341

eth-limo opened this issue Sep 9, 2022 · 5 comments
Assignees
Labels
enhancement New feature or improvement. fixed/complete This Bug is fixed or Enhancement is complete and published.

Comments

@eth-limo
Copy link

eth-limo commented Sep 9, 2022

Ethers Version

5.7.0

Search Terms

unsupported protocol data UNSUPPORTED_OPERATION

Describe the Problem

While using the nodejs implementation, resolving a CCIP domain configured with data:uri as a gateway URL throws an UNSUPPORTED_OPERATION exception.

In this example, 0.bensyc.eth is attempting to fetch ENS records from another .eth domain.

However, this does appear to work in a browser, just not with server side nodejs.

Code Snippet

const { ethers } = require("ethers");

infura = new ethers.providers.InfuraProvider("mainnet", {
  projectId: "",
});

async function getDomain() {
  let resolver = await infura.getResolver("0.bensyc.eth");
  resolver.getAddress().then(console.log);
  resolver.getContentHash().then(console.log);
}

getDomain()

Errors

/home/user/node_modules/@ethersproject/logger/lib/index.js:238
        var error = new Error(message);
                    ^

Error: missing response (requestBody=null, requestMethod="GET", serverError={"reason":"unsupported protocol data:","code":"UNSUPPORTED_OPERATION","protocol":"data:","operation":"request"}, url="data:text/plain,{\"data\":\"0x000000000000000000000000edc21400dafd1cba357cbe99d56197c20da51d37\"}", code=SERVER_ERROR, version=web/5.7.0)
    at Logger.makeError (/home/user/node_modules/@ethersproject/logger/lib/index.js:238:21)
    at Logger.throwError (/home/user/node_modules/@ethersproject/logger/lib/index.js:247:20)
    at /home/user/node_modules/@ethersproject/web/lib/index.js:255:36
    at step (/home/user/node_modules/@ethersproject/web/lib/index.js:33:23)
    at Object.throw (/home/user/node_modules/@ethersproject/web/lib/index.js:14:53)
    at rejected (/home/user/node_modules/@ethersproject/web/lib/index.js:6:65)
    at processTicksAndRejections (node:internal/process/task_queues:96:5) {
  reason: 'missing response',
  code: 'SERVER_ERROR',
  requestBody: null,
  requestMethod: 'GET',
  serverError: Error: unsupported protocol data: (protocol="data:", operation="request", code=UNSUPPORTED_OPERATION, version=web/5.7.0)
      at Logger.makeError (/home/user/node_modules/@ethersproject/logger/lib/index.js:238:21)
      at Logger.throwError (/home/user/node_modules/@ethersproject/logger/lib/index.js:247:20)
      at /home/user/node_modules/@ethersproject/web/lib/geturl.js:130:36
      at step (/home/user/node_modules/@ethersproject/web/lib/geturl.js:33:23)
      at Object.next (/home/user/node_modules/@ethersproject/web/lib/geturl.js:14:53)
      at /home/user/node_modules/@ethersproject/web/lib/geturl.js:8:71
      at new Promise (<anonymous>)
      at __awaiter (/home/user/node_modules/@ethersproject/web/lib/geturl.js:4:12)
      at getUrl (/home/user/node_modules/@ethersproject/web/lib/geturl.js:100:12)
      at /home/user/node_modules/@ethersproject/web/lib/index.js:214:66 {
    reason: 'unsupported protocol data:',
    code: 'UNSUPPORTED_OPERATION',
    protocol: 'data:',
    operation: 'request'
  },
  url: 'data:text/plain,{"data":"0x000000000000000000000000edc21400dafd1cba357cbe99d56197c20da51d37"}'
}


### Environment

node.js (v12 or newer)

### Environment (Other)

_No response_
@eth-limo eth-limo added the investigate Under investigation and may be a bug. label Sep 9, 2022
@ricmoo ricmoo added the on-deck This Enhancement or Bug is currently being worked on. label Sep 9, 2022
@ricmoo
Copy link
Member

ricmoo commented Sep 9, 2022

Thanks. I’ll look into this shortly. :)

@ricmoo ricmoo added enhancement New feature or improvement. and removed investigate Under investigation and may be a bug. labels Sep 14, 2022
@ricmoo
Copy link
Member

ricmoo commented Sep 14, 2022

To add support for non-base64-encoded Data URLs, I'll be ripping off the related v6 code. ;)

@ricmoo
Copy link
Member

ricmoo commented Sep 14, 2022

This has been added in [5.7.1](release: https://github.com/ethers-io/ethers.js/releases/tag/v5.7.1). Try it out and let me know how it works for you.

Thanks! :)

@ricmoo ricmoo added fixed/complete This Bug is fixed or Enhancement is complete and published. and removed on-deck This Enhancement or Bug is currently being worked on. labels Sep 14, 2022
@eth-limo
Copy link
Author

@ricmoo thank you! This works!

@ricmoo
Copy link
Member

ricmoo commented Sep 15, 2022

Awesome! Thanks! :)

@ricmoo ricmoo closed this as completed Sep 15, 2022
Woodpile37 pushed a commit to Woodpile37/ethers.js that referenced this issue Jan 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or improvement. fixed/complete This Bug is fixed or Enhancement is complete and published.
Projects
None yet
Development

No branches or pull requests

2 participants