Duet3D Logo Duet3D
    • Tags
    • Documentation
    • Order
    • Register
    • Login

    custom_http_endpoint.py example - http error 500?

    Scheduled Pinned Locked Moved Solved
    DSF Development
    2
    4
    225
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • oozeBotundefined
      oozeBot
      last edited by oozeBot

      @chrishamm @Falcounet

      We are evaluating the custom_http_endpoint.py example located at
      https://github.com/Duet3D/dsf-python/blob/main/examples/custom_http_endpoint.py. We are running dsf-python-3.4.6.post4. The example is returning a 500 error and we are unsure how to debug it to move past it. Here is the output from the console while running:

      send: {"mode":"Command","version":12}
      recv: {"success":true}
      send: {"command":"AddHttpEndpoint","EndpointType":"GET","Namespace":"custom","Path":"getIt","IsUploadRequest":false}
      recv: {"result":"/run/dsf/custom/getIt-GET.sock","success":true}
      Try accessing http://duet3.local/machine/custom/getIt in your browser...
      

      Any thoughts on what might be wrong? Thanks in advance.

      1 Reply Last reply Reply Quote 0
      • oozeBotundefined
        oozeBot
        last edited by

        Bump.. So far I have not been able to find any logging or details on why it is returning a 500 error. Note that any invalid URL returns 404, so DSF is picking up that it's been registered.

        Maybe the example is from a previous version of dsf-python and needs updating? Please advise as we do have a use for this and are quite motivated to put it into practice. Thanks

        chrishammundefined 1 Reply Last reply Reply Quote 0
        • oozeBotundefined oozeBot marked this topic as a question
        • chrishammundefined
          chrishamm administrators @oozeBot
          last edited by

          @oozeBot Are you running this script as root or as a user that is not part of the dsf group? To debug this problem, you'd have to look in the duetwebserver journalctl log, which generates a message when it fails to access your custom HTTP endpoint.

          If you run it as root, you need to change the ownership of the corresponding socket file (/run/dsf/custom/getIt-GET.sock) to dsf before the web server (running as dsf user) can access it.

          Duet software engineer

          oozeBotundefined 1 Reply Last reply Reply Quote 0
          • oozeBotundefined
            oozeBot @chrishamm
            last edited by

            @chrishamm Thanks! That’s the nudge we needed- It’s definitely a permission issue. We’ll get it sorted.

            1 Reply Last reply Reply Quote 0
            • oozeBotundefined oozeBot has marked this topic as solved
            • First post
              Last post
            Unless otherwise noted, all forum content is licensed under CC-BY-SA