When using package action the CWD should be the root of the extracted zip
Closed this issue · 1 comments
When using package action the CWD should be the root of the extracted zip
Currently users need to use __dirname
to reference a file inside they zip, this creates problems when developing local as usually the node process is started on the root of the nodejs module.
The proposed solution is to apply same technique from the python package actions, for the proxy to change the current process CWD to be the root of the directory where the package action is extracted.
The change should be done in this area to add process.chdir()
:
https://github.com/apache/incubator-openwhisk-runtime-nodejs/blob/master/core/nodejsActionBase/runner.js#L55
return unzipInTmpDir(message.code).then(function (moduleDir) {
process.chdir(moduleDir)
A test case should be added, it could be a simple one that a zip action includes a txt file that the action will read from the current directory and return back the content.
cc @eweiter
Closed as duplicate #57