Expand my Community achievements bar.

SOLVED

Why does `aio rt action create` always throw error `Provide a valid path for ACTION`?

Avatar

Level 7

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?

Topics

Topics help categorize Community content and increase your ability to discover relevant content.

1 Accepted Solution

Avatar

Correct answer by
Employee

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

View solution in original post

4 Replies

Avatar

Employee

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

Avatar

Employee

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.

Avatar

Correct answer by
Employee

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

Avatar

Level 7

Thanks this is what I was trying todo and was breaking head with wrong command. This works perfect. thanks.