I tried
aio rt action create generic index.js
aio rt action create generic ./actions/index.js
aio rt action create generic ../index.js
aio rt action create generic ~/code/project/actions/generic.js
everytime it throws error
Error: failed to create the action: Provide a valid path for ACTION
› specify --verbose flag for more information
What is the correct syntax to create action to existing aio project?
Solved! Go to Solution.
Topics help categorize Community content and increase your ability to discover relevant content.
If you want to add a new action to your app builder project the command is:
aio app add action
This will prompt you for some info and add generic action code to your project that you can modify and deploy with aio app deploy | aio app run
Hello,
Just as a side note, in case you are in a valid App Builder project, created with
aio app init
then you can simply run
aio app deploy
and this will deploy all actions configured in your app.config.yaml (the runtimeManifest may be located in an included configuration file, typically ext.config.yaml)
Now, if you still want to create an action through the aio rt create command, you must ensure the action file exists, could you try to run commands
ls <path_to_my_action>
to ensure the action file exists before running the aio rt create command
I expect `aio runtime action create` does not do what you are expecting. This low-level command 'creates' the action in the Runtime environment, locally you are expected to have the code already.
aio rt action create ACTIONNAME [ACTIONPATH] [--cert <value>] [--key <value>] [--apiversion <value>] [--apihost <value>] [-u
<value>] [-i] [--debug <value>] [-v] [--version] [--help] [-p <value>] [--copy <value>] [-e <value>] [--web-secure <value>
--web true|yes|false|no|raw] [-P <value>] [-E <value>] [-t <value>] [-m <value>] [-l <value>] [-c <value>] [--kind <value>]
[-a <value>] [-A <value>] [--sequence <value>] [--docker <value>] [--main <value>] [--binary] [--json]
// actionMain.js
async function main (params) {
return {
statusCode: 200,
body: {
message: 'Hello, world!'
}
}
}
`aio rt action create myAction ./actionMain.js`
Will deploy this action code.
Views
Replies
Total Likes
If you want to add a new action to your app builder project the command is:
aio app add action
This will prompt you for some info and add generic action code to your project that you can modify and deploy with aio app deploy | aio app run
Thanks this is what I was trying todo and was breaking head with wrong command. This works perfect. thanks.
Views
Replies
Total Likes
I wonder why does Adobe documentation still says to use
aio rt:action:create test first-function.js
https://developer.adobe.com/app-builder/docs/guides/runtime_guides/creating-actions
Views
Replies
Total Likes
Because this command is for action code that already exists and provides a path for that use case. The add action command is for adding generic code that you will modify down the road.
I have reviewed the developer documentation that reference you have shared
https://developer.adobe.com/app-builder/docs/guides/runtime_guides/creating-actions.
From my understanding, the action path error occurs when the action file is not found in the local project setup directory system.
error: failed to create the action: Provide a valid path for ACTION
I successfully created the action by running the following command in the project root directory:
aio rt action create generic-one ./actions/generic/index.js
Additionally, I was able to invoke the action via the command line using this command:
aio rt:action:invoke generic-one --param name "Vishhal" --result
Finally, we can link this action to a web-enabled route or schedule it to run at specific intervals by defining the trigger and rule in the `app.config.yaml` file.
Views
Replies
Total Likes
Views
Like
Replies
Views
Like
Replies