Skip to content
CCPEDIAby Unity Nodes
App Development

Enabling grpc server reflection extension

3 posts683 views1 likesLast activity Aug 2022

  1. DarkoOP 1

    Would there be a downside to enabling grpc server reflection on the ledger-api?

    Given that Postman has started supporting gRPC, and as of this version, they fixed a bug that prevented our protos to be imported, it would be neat if one could easily test/explore the LedgerAPI with Postman.

    One way would be to grab all the protos from the repository and then import all of them individually.
    There is also the possibility of using grpc server reflection. However, when trying it, postman returns “Server Reflection Failed”. I’m assuming that the extension is not enabled as described here.

    Would it be sensible to enable this extension?

  2. cocreature

    As far as I know grpc reflection is enabled. Running grpcurl against the ledger API exposed by daml sandbox works without any issues:

    moritz@adjunction ~ [2]> grpcurl -plaintext localhost:6865 list
    com.daml.ledger.api.v1.ActiveContractsService
    com.daml.ledger.api.v1.CommandCompletionService
    com.daml.ledger.api.v1.CommandService
    com.daml.ledger.api.v1.CommandSubmissionService
    com.daml.ledger.api.v1.LedgerConfigurationService
    com.daml.ledger.api.v1.LedgerIdentityService
    com.daml.ledger.api.v1.PackageService
    com.daml.ledger.api.v1.TransactionService
    com.daml.ledger.api.v1.VersionService
    com.daml.ledger.api.v1.admin.ConfigManagementService
    com.daml.ledger.api.v1.admin.MeteringReportService
    com.daml.ledger.api.v1.admin.PackageManagementService
    com.daml.ledger.api.v1.admin.ParticipantPruningService
    com.daml.ledger.api.v1.admin.PartyManagementService
    com.daml.ledger.api.v1.admin.UserManagementService
    grpc.health.v1.Health
    grpc.reflection.v1alpha.ServerReflection
    

    There was a bug in some older versions so make sure that you’re testing against 2.3.2.

  3. Darko

    I’ve just realized that it must be enabled by looking here

    github.com

    digital-asset/daml/blob/95d00c4e8ac307cee9e64f85e30c148f69d36e07/ledger/participant-integration-api/src/main/scala/platform/apiserver/ApiServices.scala

    // Copyright (c) 2022 Digital Asset (Switzerland) GmbH and/or its affiliates. All rights reserved.
    // SPDX-License-Identifier: Apache-2.0
    
    package com.daml.platform.apiserver
    
    import akka.stream.Materializer
    import com.daml.api.util.TimeProvider
    import com.daml.grpc.adapter.ExecutionSequencerFactory
    import com.daml.ledger.api.SubmissionIdGenerator
    import com.daml.ledger.api.auth.Authorizer
    import com.daml.ledger.api.auth.services._
    import com.daml.ledger.api.domain.LedgerId
    import com.daml.ledger.api.health.HealthChecks
    import com.daml.ledger.client.services.commands.CommandSubmissionFlow
    import com.daml.ledger.participant.state.index.v2._
    import com.daml.ledger.participant.state.{v2 => state}
    import com.daml.ledger.resources.{Resource, ResourceContext, ResourceOwner}
    import com.daml.lf.data.Ref
    import com.daml.lf.engine._
    import com.daml.logging.{ContextualizedLogger, LoggingContext}
    
    This file has been truncated. show original

    Hmm - then I’ll have to figure out why postman doesn’t like it.

    Thanks @cocreature