Closed maximilianvoss closed 5 years ago
@maximilianvoss you need to add a package.json
file into the actions/hello
folder if you want to package your actions as a zip action.
Are there any reasons you want to use a zip action? It is usually more efficient to use the bundled action (point to a file)
+1 We should discourage the use of zip action, as it has major impact on action execution time (especially cold start).
Just imagine you want to create an action which authenticates against Adobe IO, where would you put the private key?
nevertheless, the package.json did the trick. Closing. Thanks a lot
The common way of doing this would be to define a default parameter for your action in your manifest.yml
, like
packages:
__CNA_PACKAGE__:
license: Apache-2.0
actions:
hello:
function: actions/hello/index.js
web: yes
runtime: 'nodejs:10'
input:
key: ${KEY_VALUE}
And then you save the KEY_VALUE in your .env
so that your key is not visible in your repository
You can then get the key
from your main function args in the action
And if you really want to embed additional data in your action and don't use a zip action simply define a config.json
file in the hello/
folder and require('./config.json')
from your index.js
, the bundler will then automatically package it with the action
A ZIP is build, but the JavaScript is never compiled with npm.