Skip to content
CCPEDIAby Unity Nodes
App Development

useStreamQueries can not resolve the template ID

3 posts278 viewsLast activity Mar 2022

  1. galiliyoOP

    When I use
    useStreamQueries(BidInvitationOfferToBanker);

    I get an error stating the
    unknownTemplateIds":["4615f3be8dbc594abb31f5ac8440dbd9159ae8218335837b401e1e722083eb96:Main.MinistryOfTreasury:BidInvitationOfferToBankerMain.MinistryOfTreasury:BidInvitationOfferToBanker

    however, when I use

    http://localhost:3000/v1/query
    payload :
     templateIds: ["Main.MinistryOfTreasury:BidInvitationOfferToBanker"]
    

    The result comes back as expected

    Any ideas why the http api call works but the websocket version fails?

    ================================
    the BidInvitationOfferToBanker type is:

    (alias) namespace BidInvitationOfferToBanker
    (alias) const BidInvitationOfferToBanker: damlTypes.Template<BidInvitationOfferToBanker, BidInvitationOfferToBanker.Key, "4615f3be8dbc594abb31f5ac8440dbd9159ae8218335837b401e1e722083eb96:Main.MinistryOfTreasury:BidInvitationOfferToBanker"> & BidInvitationOfferToBankerInterface
    import BidInvitationOfferToBanker
    
  2. Gary_Verhaegen

    Hi @galiliyo,

    Your browser should be able to give you more detail on the exact request it sent.

    This kind of error can happen when the version of the DAR on the ledger does not match the version of the DAR that has been provided to the TS codegen; assuming you’re working against a sandbox, It may be as simple as forgetting to press r on daml start to refresh. I’d first try to clean everything and restart with a fresh sandbox.

    To help you further, we’d need a bit more details on exactly what you did and the complete error messages. For example:

    • How did you start your ledger?
    • Do you know that your browser is talking to the same JSON API as your “manual” HTTP request?
    • How did you make that HTTP request? Can you share the full cycle? E.g. if it was a curl command, please share the full terminal output as well as the full curl command (minus token).
    • What setup are you using to test your JS code? Is it running in the browser, or on Node?
    • Could you share the line of code that generated the error, as well as thee full error message?
  3. galiliyo

    Hi, Thanks for your reply
    I have restarted and went through all that workflow a few times without success.
    But some how it started to work all of a sudden… A mystery.
    Seems like it’s related to missing packages, but I can not verify.
    Will update if there’s any change