cardano-foundation / cardano-graphql

GraphQL API for Cardano
Apache License 2.0
263 stars 104 forks source link

Cannot return null for non-nullable field Redeemer.scriptHash #895

Open alecalve opened 2 months ago

alecalve commented 2 months ago

Summary

This error happened first when querying this transaction with the following GraphQL query:

query Query($txHash: Hash32Hex) {
    transactions(where: {hash: {_eq: $txHash}}) {
        redeemers {
            scriptHash
        }
    }
}

Steps to reproduce the bug

Run the query against a Cardano graphql instance

Actual Result

See the following error:

Error(
    message = Cannot return null for non-nullable field Redeemer.scriptHash., 
    locations = [Location(line = 1, column = 115)], 
    customAttributes = {path=[transactions, 0, redeemers, 0, scriptHash], 
    extensions={
        code=INTERNAL_SERVER_ERROR, 
        exception={
            stacktrace=[
                Error: Cannot return null for non-nullable field Redeemer.scriptHash.,     
                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 completeValueCatchingError (/app/node_modules/graphql/execution/execute.js:495:19),     
                at /app/node_modules/graphql/execution/execute.js:618:25,     
                at Array.forEach (<anonymous>)
            ]
        }
    }
})

Expected Result

We'd expect to get a successful output.

Environment

    image: ghcr.io/intersectmbo/cardano-node:9.1.0
    image: cardanosolutions/ogmios:v6.5.0
    image: ghcr.io/intersectmbo/cardano-db-sync:13.5.0.0
    image: postgres:14-alpine
    image: cardanofoundation/cardano-graphql-hasura:8.2.0
    image: cardanofoundation/cardano-graphql-background:8.2.0-mainnet
    image: cardanofoundation/cardano-graphql:8.2.1

Platform

Platform version

No response

Runtime

Runtime version

No response

Kammerlo commented 2 months ago

Could you provide me the transaction hash you were trying to fetch? Because I can't reproduce it with others.

alecalve commented 2 months ago

It's this one https://cardanoscan.io/transaction/95f880700a8ad31515aeece30737868b9dcd26ade91e909b25a4d033bfe4840d?tab=summary

Kammerlo commented 1 month ago

@alecalve Sorry for the very late reply. I started to reproduce the error, but still can't manage to get the same error message. When querying your example request I get the following response: { "data": { "transactions": [ { "redeemers": [ { "scriptHash": null } ] } ] } }

In CardanoScan I see that there is a contract, but the data is null as well. So the response I get seems correct (I double checked it on db-sync database level). If the data is wrong it might be a problem for db-sync.

Did you manage to find the issue for your problem?