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

Hitting an undefined is not iterable with sigsAndProofs error in the README example. #458

Open
johnnymatthews opened this issue Jan 21, 2025 · 2 comments
Assignees

Comments

@johnnymatthews
Copy link
Contributor

Was running through the example in this repo's README and his this error:

file:///home/johnny/Code/entropy/testing-sdk/node_modules/@entropyxyz/sdk/dist/index.js:440
    const [sig, proof] = sigsAndProofs[Math.floor(Math.random() * sigsAndProofs.length)];
                         ^

TypeError: undefined is not iterable (cannot read property Symbol(Symbol.iterator))
    at #verifyAndPick (file:///home/johnny/Code/entropy/testing-sdk/node_modules/@entropyxyz/sdk/dist/index.js:440:26)
    at SignatureRequestManager.sign (file:///home/johnny/Code/entropy/testing-sdk/node_modules/@entropyxyz/sdk/dist/index.js:330:48)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async SignatureRequestManager.signWithAdaptersInOrder (file:///home/johnny/Code/entropy/testing-sdk/node_modules/@entropyxyz/sdk/dist/index.js:292:23)
    at async Entropy.signWithAdaptersInOrder (file:///home/johnny/Code/entropy/testing-sdk/node_modules/@entropyxyz/sdk/dist/index.js:844:12)
    at async basicExample (file:///home/johnny/Code/entropy/testing-sdk/basic_example.mjs:24:27)

Node.js v20.18.1
@johnnymatthews johnnymatthews changed the title undefined sigsAndProofs error in the README example. Hitting an undefined is not iterable with sigsAndProofs error in the README example. Jan 21, 2025
@johnnymatthews
Copy link
Contributor Author

Did a bit more digging. I'm pretty sure this error is popping up because the account I used was already registered to the program I was using. I tried running the example again but with a completely new account, and didn't get this error.

I'll leave it to you @frankiebee if you wanna debug this a bit further. Otherwise, I'm happy for you to close it.

@frankiebee frankiebee self-assigned this Jan 21, 2025
@mixmix
Copy link
Collaborator

mixmix commented Jan 23, 2025

AYE, seeing this too on the entropy sign command, but not in e2e tests....

sigsAndProofs is [undefined, undefined] which is a failure of

async function sendHttpPost(url, data) {
  const headers = {
    "Content-Type": "application/json"
  };
  const response = await fetch(url, {
    method: "POST",
    headers,
    body: data
  });
  if (!response.ok) {
    throw new Error(
      `request failed ${response.status}, ${response.statusText} fetch: ${url} FULLRESPONSE: ${await response.text()}`
    );
  }
  const reader = response.body.getReader();
  const start = (controller) => {
    async function pump() {
      const { done, value } = await reader.read();
      if (done) {
        controller.close();
        return;
      }
      controller.enqueue(value);
      return pump();
    }
    return pump();
  };
  const stream = new ReadableStream({ start });
  const streamResponse = new Response(await stream);
  if (!streamResponse.ok) {
    throw new Error(
      `request failed ${streamResponse.status}, ${streamResponse.statusText} FULLRESPONSE: ${await streamResponse.text()}`
    );
  }
  const responseResult = await streamResponse.json();
  const oks = responseResult.map((r) => r.Ok);     // <=========== HERE
  return oks;
}

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

3 participants