You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Node platform.api: wrong argument order fails silently (callback never fires) #70
platform.api in the Node.js engine fails silently when arguments are in the wrong position. Reproduced on 7.7.0 (df-script dev-develop4fa09c4).
Repro (Node scripted service, local echo server as target):
// bug form: callback passed in the 3rd (options) slot, like get()platform.api.delete(path,{marker: 'v1'},function(body){/* never runs */});// correct formsplatform.api.delete(path,{marker: 'v2'},{},function(body){/* runs */});platform.api.delete(path,null,{},function(body){/* runs, true DELETE */});
Observed (bug form):
The callback never fires. No error is thrown or logged.
The request is sent as POST with x-http-method: DELETE (truthy payload path, src/Engines/NodeJs.php ~243).
The callback function is serialized into a bogus headers request header, and the payload body is empty.
Cause:get(path, options, callback) vs post/put/patch/delete(path, payload, options, callback). Called get-style, callback is undefined and http.request(_options, undefined) attaches no response handler.
Fix:
In _platform.api.call (and the verb wrappers), throw a clear error when callback is not a function, naming the expected signature, e.g. platform.api.delete(path, payload, options, callback): callback must be a function.
Do not serialize non-object options into headers.
Same check for the Python engines' get vs write-verb split where it applies.
Activity