Search code examples
httpservermicropythonalpacaascom

Alpaca server : error 404, can't find why


I am trying to develop an instance of an Alpaca server for a "telescope" device on an ESP32 devkit V1 with micropython 1.20.

I used this project as a base for my purpose. I kept in particular the server part and the error handling methods, I just migrated from microdot V1 to microdot V2.

All my programs are stored in this repo : https://github.com/Sylvain-BROCAS/Starget

I wrote every default methods for a telescope device and I started to test my programs (API references here)

I am now facing the following issue : I can do requests to URLs like http://IP:port/management/..., I get a response and the response content is correct (it detects that a device is declared as a telescope with devine number = 0 and the right unique ID)

But when I try to send a request to URLs like http://IP:port/api/v1/telescope/0/connected, I get an "Error 404 : not found". neither PUT and GET methods are working.

I used the ASCOM diagnostic tool, I tried to connect, here is what I get :

 Create              Creating device Connected           Connecting to device Error 

System.Exception: Error calling method: Connected, HTTP Completion Status: Completed, Error 

Message: Not found   

à System.Dynamic.ComRuntimeHelpers.CheckThrowException(Int32 hresult, ExcepInfo& excepInfo, UInt32 argErr, String message)    
à CallSite.Target(Closure , CallSite , ComObject , Boolean )    
à ASCOM.DriverConnect.ConnectForm.btnConnect_Click(Object sender, EventArgs e) dans C:\ASCOM Build\Export\ASCOM.DriverConnect\ConnectForm.cs:ligne 261 

Dispose             Disposing of device 
Dispose             Completed disposal 
ReleaseComObject    Releasing COM instance 
ReleaseComObject    Completed release. Count: 0 
GC Collect          Starting garbage collection 
GC Collect          Completed garbage collection

I tried to get the profile of the Alpaca device, here is the trace:

<Default>                 Starget Alpaca device                    
Discovery Port            32227                     
Enable IPv4 Discovery     True                     
Enable IPv6 Discovery     True                     
Enable Rediscovery        True                     
Establish Connection Timeout 2                     
Image Array Compression   0                     
Image Array Transfer Type 3                     
Include Debug Trace       True                     
IP Address                192.168.163.206                     
Long Device Response Timeout 120                     
Manage Connect Locally    False                     
Password                  <Empty>                     
Port Number               20000                    
Remote Device Number      0                     
Service Type              http                     
Standard Device Response Timeout 10                     
Trace Level               True                     
Trust Unsigned SSL Certificates False                     
UniqueID                  2fba39e5-e84b-4d68-8aa5-fae287abc02d                     
User Name                 <Empty>

I don't understand what could cause this error since the "connected" endpoint is defined through a function (in <my repo>/src/alpacadevice.py).

Somebody told me it could be a problem with unsigned packets in the TCP protocole. I changed "trust unsined SSL certificate" to True, nothing changes. I downloaded Wireshark to observe the pakets exchanges, the result of the conversation is on the attached screenshots : enter image description here

enter image description here

Does anyone have clues to help me solving this problem ?

Thank you for your help and have a nice day ^^


Solution

  • Update : The problem was caused by a bug in Microdot V2.0.4. Upgrading it to 2.0.5 release solves the problem