You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@openwhisk.apache.org by GitBox <gi...@apache.org> on 2020/08/17 18:42:06 UTC

[GitHub] [openwhisk-wskdebug] alexkli opened a new issue #79: nodejs mounted action runner should set the right current working directory

alexkli opened a new issue #79:
URL: https://github.com/apache/openwhisk-wskdebug/issues/79


   In case actions are mounted locally in the container, the source directory is `/code` not `/nodejsAction`. The current working directory is normally `/nodejsAction` and some code might rely on it to find other files, so it should be adjusted accordingly if it's `/code`.


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [openwhisk-wskdebug] alexkli edited a comment on issue #79: nodejs mounted action runner should set the right current working directory

Posted by GitBox <gi...@apache.org>.
alexkli edited a comment on issue #79:
URL: https://github.com/apache/openwhisk-wskdebug/issues/79#issuecomment-727148588


   The fix is probably to simply change the dir to `/code/....` in both mount scripts at the start of their `main()` functions:
   
   - here for mount-require.js: https://github.com/apache/openwhisk-wskdebug/blob/master/src/kinds/nodejs/mount-require.js#L39
   - here for mount-plain.js: https://github.com/apache/openwhisk-wskdebug/blob/master/src/kinds/nodejs/mount-plain.js#L46
   
   It would probably have to take the parent dir of the `sourcePath`, i.e. set the cwd to the dir of the source file being required:
   
   ```javascript
   process.chdir(path.dirname(path));
   ```
   
   Not sure if this will fully address https://github.com/adobe/aio-cli-plugin-app/issues/282 because it depends how the action.zip is packaged and how that might be different from the raw source structure that is mounted 1:1 in the wskdebug mounting case.
   
   cc @shazron


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [openwhisk-wskdebug] alexkli commented on issue #79: nodejs mounted action runner should set the right current working directory

Posted by GitBox <gi...@apache.org>.
alexkli commented on issue #79:
URL: https://github.com/apache/openwhisk-wskdebug/issues/79#issuecomment-727148588


   The fix is probably to simply change the dir to `/code` in both mount scripts at the start of their `main()` functions:
   
   - here for mount-require.js: https://github.com/apache/openwhisk-wskdebug/blob/master/src/kinds/nodejs/mount-require.js#L39
   - here for mount-plain.js: https://github.com/apache/openwhisk-wskdebug/blob/master/src/kinds/nodejs/mount-plain.js#L46
   
   It would probably have to take the parent dir of the `sourcePath`, i.e. set the cwd to the dir of the source file being required:
   
   ```javascript
   process.chdir(path.dirname(path));
   ```
   
   Not sure if this will fully address https://github.com/adobe/aio-cli-plugin-app/issues/282 because it depends how the action.zip is packaged and how that might be different from the raw source structure that is mounted 1:1 in the wskdebug mounting case.
   
   cc @shazron


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [openwhisk-wskdebug] shazron commented on issue #79: nodejs mounted action runner should set the right current working directory

Posted by GitBox <gi...@apache.org>.
shazron commented on issue #79:
URL: https://github.com/apache/openwhisk-wskdebug/issues/79#issuecomment-770650090


   PR https://github.com/apache/openwhisk-wskdebug/pull/85


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org