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

INTERNAL_SERVER_ERROR: TypeError: Cannot read properties of null (reading 'assetId') #877

Open
6 tasks
cryptosystems6300 opened this issue Jul 4, 2024 · 2 comments
Labels

Comments

@cryptosystems6300
Copy link

Summary

Graphql query returns an unexpected internal server error

Steps to reproduce the bug

  1. send graphql query
query {
  paymentAddresses(
    addresses: [
      "addr1qygcsk5l4xh3y3m8j8akv93yyun06wfadrr3de02vj80xyg33pdfl2d0zfrk0y0mvctzgfexl5un66x8zmj75eyw7vgsfpl75e"
    ]
  ) {
    summary {
      assetBalances {
        asset {
          assetId
        }
        quantity
      }
    }
  }
}

Actual Result

{
  "errors": [
    {
      "message": "TypeError: Cannot read properties of null (reading 'assetId')",
      "locations": [
        {
          "line": 5,
          "column": 5
        }
      ],
      "path": [
        "paymentAddresses",
        0,
        "summary"
      ],
      "extensions": {
        "code": "INTERNAL_SERVER_ERROR",
        "exception": {
          "stacktrace": [
            "Error: TypeError: Cannot read properties of null (reading 'assetId')",
            "    at /app/packages/api-cardano-db-hasura/dist/executableSchema.js:93:39",
            "    at Generator.throw (<anonymous>)",
            "    at rejected (/app/packages/api-cardano-db-hasura/dist/executableSchema.js:6:65)",
            "    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)"
          ]
        }
      }
    }
  ],
  "data": {
    "paymentAddresses": [
      {
        "summary": null
      }
    ]
  }
}

Expected Result

actual balances

Environment

mainnet

Platform

  • Linux (Ubuntu)
  • Linux (Other)
  • macOS
  • Windows

Platform version

No response

Runtime

  • Node.js
  • Docker

Runtime version

No response

@itsmehdiabdi
Copy link

Summary

Graphql query returns an unexpected internal server error

Steps to reproduce the bug

  1. send graphql query
query {
  paymentAddresses(
    addresses: [
      "addr1qygcsk5l4xh3y3m8j8akv93yyun06wfadrr3de02vj80xyg33pdfl2d0zfrk0y0mvctzgfexl5un66x8zmj75eyw7vgsfpl75e"
    ]
  ) {
    summary {
      assetBalances {
        asset {
          assetId
        }
        quantity
      }
    }
  }
}

Actual Result

{
  "errors": [
    {
      "message": "TypeError: Cannot read properties of null (reading 'assetId')",
      "locations": [
        {
          "line": 5,
          "column": 5
        }
      ],
      "path": [
        "paymentAddresses",
        0,
        "summary"
      ],
      "extensions": {
        "code": "INTERNAL_SERVER_ERROR",
        "exception": {
          "stacktrace": [
            "Error: TypeError: Cannot read properties of null (reading 'assetId')",
            "    at /app/packages/api-cardano-db-hasura/dist/executableSchema.js:93:39",
            "    at Generator.throw (<anonymous>)",
            "    at rejected (/app/packages/api-cardano-db-hasura/dist/executableSchema.js:6:65)",
            "    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)"
          ]
        }
      }
    }
  ],
  "data": {
    "paymentAddresses": [
      {
        "summary": null
      }
    ]
  }
}

Expected Result

actual balances

Environment

mainnet

Platform

  • Linux (Ubuntu)
  • Linux (Other)
  • macOS
  • Windows

Platform version

No response

Runtime

  • Node.js
  • Docker

Runtime version

No response

i'm facing the same issue.
i get this error when i run the same query with an account that has many different tokens. the account you mentioned has 50 different tokens!
in my case i just need ada balance. but i don't know how to filter it and just get ada balance. i think it would solve my own problem.
@cryptosystems6300

@itsmehdiabdi
Copy link

in my case this helped me:
`
query = """
query PaymentAddressSummary ($address: String!){
utxos (
where: {
_and: {
address: { _eq: $address }
}
}
) {
value
}
}

"""

graphql_url = "https://explorer.cardano.org/graphql/"
address = "addr1vqkzkjxm33tms7xr5qjuu92m3ygs8mpfvvyncp3atj08hlgh9n7xs"
data = {"query": query, "variables": {"address": address}}
response = requests.post(
url=graphql_url,
headers={"Content-Type": "application/json"},
data=json.dumps(data),
timeout=60,
)

utxos = response.json().get("data").get("utxos")
balance = sum([utxo['value'] for utxo in utxos])
print(balance)
`

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

No branches or pull requests

2 participants