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

Field aliasing via delegated schema not remapping field names #164

Closed
islishude opened this issue May 5, 2020 · 5 comments
Closed

Field aliasing via delegated schema not remapping field names #164

islishude opened this issue May 5, 2020 · 5 comments
Labels
BUG SEVERITY:LOW Small defects which does not prevent any crucial functionality to work.

Comments

@islishude
Copy link
Contributor

api: https://cardano-graphql-mainnet.daedalus-operations.com/

query test {
  blocks (limit: 1, order_by: { createdAt: desc}) {
    blockHash: id # alias id to blockHash
    epochNo
    slotWithinEpoch
    slotNo
    createdAt
  }
}
{
  "errors": [
    {
      "message": "Cannot return null for non-nullable field Block.id.",
      "locations": [
        {
          "line": 3,
          "column": 5
        }
      ],
      "path": [
        "blocks",
        0,
        "blockHash"
      ],
      "extensions": {
        "code": "INTERNAL_SERVER_ERROR",
        "exception": {
          "stacktrace": [
            "Error: Cannot return null for non-nullable field Block.id.",
            "    at completeValue (/application/node_modules/graphql/execution/execute.js:560:13)",
            "    at completeValueCatchingError (/application/node_modules/graphql/execution/execute.js:495:19)",
            "    at resolveField (/application/node_modules/graphql/execution/execute.js:435:10)",
            "    at executeFields (/application/node_modules/graphql/execution/execute.js:275:18)",
            "    at collectAndExecuteSubfields (/application/node_modules/graphql/execution/execute.js:713:10)",
            "    at completeObjectValue (/application/node_modules/graphql/execution/execute.js:703:10)",
            "    at completeValue (/application/node_modules/graphql/execution/execute.js:591:12)",
            "    at completeValueCatchingError (/application/node_modules/graphql/execution/execute.js:495:19)",
            "    at /application/node_modules/graphql/execution/execute.js:618:25",
            "    at Array.forEach (<anonymous>)"
          ]
        }
      }
    }
  ],
  "data": {
    "blocks": [
      null
    ]
  }
}
@rhyslbw rhyslbw added the BUG label May 12, 2020
@rhyslbw
Copy link
Contributor

rhyslbw commented May 12, 2020

Sorry for the delay in response @islishude

Reopening, as it's a bug I need to investigate. The expectation is for the aliases to be remapped after the delegated response is returned from Hasura, since makeRemoteExecutableSchema should handle this.

On a side-node, the specific alias you're making here should be addressed in #175

@rhyslbw rhyslbw reopened this May 12, 2020
@rhyslbw rhyslbw changed the title Can't alias a filed Field aliasing via delegated schema not remapping field names May 12, 2020
@rhyslbw rhyslbw added the SEVERITY:LOW Small defects which does not prevent any crucial functionality to work. label Aug 26, 2020
@dingxiangfei2009
Copy link

dingxiangfei2009 commented Sep 17, 2021

Hello, @islishude and @rhyslbw. It seems that this issue still persists for cardano-graphql@5.1.0. Would you mind re-visiting this?

Here is a sample query to reproduce it.

query (
  $where: Epoch_bool_exp
){
  epochs( where: $where ) {
    protocolParams {
      feeFixed: minFeeA
      feePerByte: minFeeB
    }
  }
}

Any query parameters will do, such as the following

{
  "where": {
    "number": {
      "_eq": 156
    }
  }
}

The error message is the following.

{
  "errors": [
    {
      "message": "Cannot return null for non-nullable field ShelleyProtocolParams.minFeeA.",
      "locations": [
        {
          "line": 4,
          "column": 7
        }
      ],
      "path": [
        "epochs",
        0,
        "protocolParams",
        "feeFixed"
      ],
      "extensions": {
        "code": "INTERNAL_SERVER_ERROR",
        "exception": {
          "stacktrace": [
            "Error: Cannot return null for non-nullable field ShelleyProtocolParams.minFeeA.",
            "    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 resolveField (/app/node_modules/graphql/execution/execute.js:435:10)",
            "    at executeFields (/app/node_modules/graphql/execution/execute.js:275:18)"
          ]
        }
      }
    }
  ],
  "data": {
    "epochs": [
      {
        "protocolParams": null
      }
    ]
  }
}

@dingxiangfei2009
Copy link

This issue may be the culprit. ardatan/graphql-tools#3267

@rhyslbw rhyslbw reopened this Sep 28, 2021
@rhyslbw
Copy link
Contributor

rhyslbw commented Sep 28, 2021

Sorry @dingxiangfei2009 , this shouldn't have been closed. We'll see if the library author has an ideas

@islishude
Copy link
Contributor Author

I will close this issue since it doesn't have any activities any more.

IF YOU NEED IT, PLEASE FILE A NEW ONE.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
BUG SEVERITY:LOW Small defects which does not prevent any crucial functionality to work.
Projects
None yet
Development

No branches or pull requests

3 participants