method() throws error: Failed invoking

Hello,

I just can't find the issue with this code, it's mostly identical to the examples in the documentation. I get the following error:

Error: Invalid Value

Details: Failed invoking <symbol>

 

Code:

import Toybox.System;
import Toybox.Communications;
import Toybox.Lang;

(:background)
class LogService {
    function onReceive(responseCode as Number, data as Dictionary?) as Void {
        if (responseCode == 200) {
            System.println("Request Successful");                   // print success
        } else {
            System.println("Response: " + responseCode);            // print response code
        }

        Background.exit();
    }

    function makeRequest() as Void {
        var url = "-";

        var params = {                                              // set the parameters
            "deviceId" => "123456789abcdefg",
            "deviceType" => "venu",
            "appName" => "test",
            "dateTime" => Time.now()
        };

        var options = {                                             // set the options
            :method => Communications.HTTP_REQUEST_METHOD_POST,      // set HTTP method
            :headers => {                                           // set headers
            "Content-Type" => Communications.REQUEST_CONTENT_TYPE_JSON},
            // set response type
            :responseType => Communications.HTTP_RESPONSE_CONTENT_TYPE_JSON
        };

        var callback = method(:onReceive);     // Here I get the error

        // onReceive() method
        // Make the Communications.makeWebRequest() call
        Communications.makeWebRequest(url, params, options, callback);
    }
}