in knative-build/runtimes/javascript/src/service.js [202:232]
function doRun(req) {
DEBUG.functionStart();
DEBUG.dumpObject(req, 'request');
var msg = req && req.body || {};
DEBUG.dumpObject(msg, 'msg');
DEBUG.trace('Adding process environment variables:');
// Move per-activation keys to process env. vars with __OW_ (reserved) prefix
Object.keys(msg).forEach(
function(k) {
if (typeof msg[k] === 'string' && k !== 'value'){
var envVariable = '__OW_' + k.toUpperCase();
process.env['__OW_' + k.toUpperCase()] = msg[k];
DEBUG.dumpObject(process.env[envVariable], envVariable, 'doRun');
}
}
);
return userCodeRunner.run(msg.value).then(function(result) {
if (typeof result !== 'object') {
console.error('Result must be of type object but has type "' + typeof result + '":', result);
}
writeMarkers();
DEBUG.functionEndSuccess('userCodeRunner.run(): Success (' + result + ')', 'doRun');
return result;
}).catch(function(error) {
console.error(error);
writeMarkers();
DEBUG.functionEndError('userCodeRunner.run(): Error:' + error, 'doRun');
return Promise.reject(error);
});
}