3

I'm trying to do async db query using SQLProvider and sqlite as db. The server side function looks like this

[Rpc]
let dbAsyncCall () =
    async {
        return! query {
            // ...
        } |> Seq.executeQueryAsync
    } 
    |> Async.StartAsTask 
    |> Async.AwaitTask 

On the client side I call it like this

async {
    let! data = Server.dbAsyncCall ()
    // ...
} |> Doc.Async

When the code gets executed I receive the following error

enter image description here

What's going on?

Thanks!

UPDATE:

Ok, it seems that the problem is somehow related to executing queries on sqlite. I mean if try to do a simple async operation async { return 5}, it gets executed without any problems, but when I do any db related queries and surround it with async, I receive the error. I know that SQLProvider supports async queries, maybe the problem with sqlite lib itself?

UPDATE 2:

What error shows js side enter image description here

Semuserable
  • 454
  • 6
  • 24
  • You need to see what the error was on the server. To do that, either attach debugger to the server process or log exceptions. – Fyodor Soikin Jul 22 '17 at 22:19
  • @FyodorSoikin sorry if the question is dumb, but I'm pretty new to a Websharper ecosystem. How can I do server logging? I surround my code with 'try' block and try to log the exception into VS "Output" window using `Debug.WriteLine` but it doesn't show anything, also when I attach a debugger server-side code doesn't get hit. – Semuserable Jul 22 '17 at 23:14

0 Answers0