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

utxo_aggregate sum error #801

Open
awesome9999 opened this issue Jan 14, 2023 · 1 comment
Open

utxo_aggregate sum error #801

awesome9999 opened this issue Jan 14, 2023 · 1 comment

Comments

@awesome9999
Copy link

awesome9999 commented Jan 14, 2023

I am trying to send this query to get amount of NFTs locked on address by policyId:
query { utxos_aggregate( where: { _and: { address: { _eq: $address }, tokens: { asset: { policyId: { _eq: "d6fe6efa7788cb70e57a91891605e3694352cabb4837e870610300e9"} } } } } ){ aggregate { sum { tokens { quantity } } } } }
It works well with count aggregate, but in case of sum aggregate it returns this error:

{ "errors": [ { "message": "Cannot return null for non-nullable field Query.utxos_aggregate.", "locations": [ { "line": 2, "column": 3 } ], "path": [ "utxos_aggregate" ], "extensions": { "code": "INTERNAL_SERVER_ERROR", "exception": { "stacktrace": [ "Error: Cannot return null for non-nullable field Query.utxos_aggregate.", " at completeValue (/app/node_modules/graphql/execution/execute.js:560:13)", " at completeValueCatchingError (/app/node_modules/graphql/execution/execute.js:495:19)", " at resolveField (/app/node_modules/graphql/execution/execute.js:435:10)", " at executeFields (/app/node_modules/graphql/execution/execute.js:275:18)", " at executeOperation (/app/node_modules/graphql/execution/execute.js:219:122)", " at executeImpl (/app/node_modules/graphql/execution/execute.js:104:14)", " at Object.execute (/app/node_modules/graphql/execution/execute.js:64:35)", " at /app/node_modules/apollo-server-core/dist/requestPipeline.js:261:48", " at Generator.next (<anonymous>)", " at /app/node_modules/apollo-server-core/dist/requestPipeline.js:8:71" ] } } } ], "data": null }

@siegfried
Copy link

siegfried commented Mar 19, 2023

We've got a similar issue so I'll just add to this one.

Query:

query UTxO($addresses: [String]!) {
  utxos(where: { address: { _in: $addresses } }) {
    address
    txHash
    index
    value
    tokens {
      asset {
        assetId
      }
      quantity
    }
  }
}

Variables:

{
	"addresses": [
	    "addr1q8l5hxd2kk2qd9vvl5mk7txrzezrlnsgym2utnt62lryphg5kkvr22hlffqdj63vk8nf8rje5np37v4fwlpvj4c4qryqz4z0sm"
	]
}

Returns:

{
  "errors": [
    {
      "message": "Cannot return null for non-nullable field Token.asset.",
      "locations": [
        {
          "line": 8,
          "column": 7
        }
      ],
      "path": [
        "utxos",
        0,
        "tokens",
        0,
        "asset"
      ],
      "extensions": {
        "code": "INTERNAL_SERVER_ERROR",
        "exception": {
          "stacktrace": [
            "Error: Cannot return null for non-nullable field Token.asset.",
            "    at completeValue (/app/node_modules/graphql/execution/execute.js:560:13)",
            "    at completeValueCatchingError (/app/node_modules/graphql/execution/execute.js:495:19)",
            "    at resolveField (/app/node_modules/graphql/execution/execute.js:435:10)",
            "    at executeFields (/app/node_modules/graphql/execution/execute.js:275:18)",
            "    at collectAndExecuteSubfields (/app/node_modules/graphql/execution/execute.js:713:10)",
            "    at completeObjectValue (/app/node_modules/graphql/execution/execute.js:703:10)",
            "    at completeValue (/app/node_modules/graphql/execution/execute.js:591:12)",
            "    at completeValue (/app/node_modules/graphql/execution/execute.js:557:21)",
            "    at completeValueCatchingError (/app/node_modules/graphql/execution/execute.js:495:19)",
            "    at /app/node_modules/graphql/execution/execute.js:618:25"
          ]
        }
      }
    }
  ],
  "data": {
    "utxos": [
      null
    ]
  }
}

As far as I know, this issue affects addresses that hold some tokens but not all, for example, Hosky is fine. After a few hours, some tokens become normal. My guess is that some information about native assets was missing or not syncing fast enough, even though our node had caught up to the tip. What is the root cause, and how can we improve it?

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

2 participants