Particle function accessible by curl but not particle-api-js.callFunction()

If I check the device with curl, the particle cloud function setsleep was successfully registered.

curl ""

  "id": "3c0043001547343433313338",
  "name": "MAJOR-101-MINOR-110",
  "last_app": null,
  "last_ip_address": "",
  "last_heard": "2016-12-20T22:30:09.124Z",
  "product_id": 6,
  "connected": true,
  "platform_id": 6,
  "cellular": false,
  "status": "normal",
  "current_build_target": "0.6.0",
  "variables": {},
  "functions": [
  "cc3000_patch_version": "wl0: Nov  7 2014 16:03:45 version FWID 01-ca525900"

If I try to access the function with curl, it succeeds.

curl -d access_token=TOKEN -d "args=120"

  "id": "3c0043001547343433313338",
  "last_app": "",
  "connected": true,
  "return_value": 0

But if I try to access the function with nodejs particle.callFunction() , I get a function not found error.

var func = particle.callFunction({
            deviceId: "3c0043001547343433313338",
            name: "setsleep",
            argument: 120,
            auth: access_token });
  function (data) {
     console.log('setsleep called successfully ', data.body.return_value);
  }, function (err) {
     console.log('error on setsleep: ', err);


error on  setsleep :  { statusCode: 404,
  errorDescription: 'HTTP error 404 from /v1/devices/3c0043001547343433313338/setsleep',
   { [Error: Not Found]
     original: null,
      { domain: null,
        _events: {},
        _maxListeners: 10,
        res: [Object],
        request: [Object],
        req: [Object],
        links: {},
        text: '{\n  "ok": false,\n  "error": "Function setsleep not found"\n}',
        body: [Object],
        files: {},
        buffered: true,
        headers: [Object],
        header: [Object],
        statusCode: 404,
        status: 404,
        statusType: 4,
        info: false,
        ok: false,
        redirect: false,
        clientError: true,
        serverError: false,
        error: [Object],
        accepted: false,
        noContent: false,
        badRequest: false,
        unauthorized: false,
        notAcceptable: false,
        forbidden: false,
        notFound: true,
        charset: 'utf-8',
        type: 'application/json',
        setEncoding: [Function],
        redirects: [] },
     status: 404 },
  body: { ok: false, error: 'Function setsleep not found' } }

The function is registered with the following code (simplified)


retained int SLEEP_TIME = 86400;

int set_SLEEP(String sleep) {
    SLEEP_TIME = atoi(sleep);
    return 0;

setup() {
 Particle.function("setsleep", set_SLEEP);

This was working fine for a good two months or so. Since I don’t believe I made any changes, then the date might be notable; It started failing on Nov 29. Node version 0.10.46, particle-api-js version 5.3.0

[Mod Edit @harrisonhjones: Formatting]