aio-cli-plugin-runtime icon indicating copy to clipboard operation
aio-cli-plugin-runtime copied to clipboard

creating apis does not work via cli command

Open shazron opened this issue 5 months ago • 4 comments

aio rt:api:create /base-1 /relative-1 get generic --response-type http

Even after waiting 5 mins, the URL results in a 404. The URL should be in the form https://adobeioruntime.net/apis/YOUR_NAMESPACE/base-1/relative-1

Deploying the same api via app.config.yaml works:

application:
  actions: actions
  web: web-src
  runtimeManifest:
    packages:
      test-app:
        license: Apache-2.0
        actions:
          generic:
            function: actions/generic/index.js
            web: 'yes'
            runtime: nodejs:18
            inputs:
              LOG_LEVEL: debug
            annotations:
              require-adobe-auth: false
              final: true
        apis:
          my-api-name:
            base-1:
              relative-1:
                generic:
                  method: get
                  response: http

shazron avatar Jul 18 '25 09:07 shazron

JIRA issue created: https://jira.corp.adobe.com/browse/ACNA-3901

aiojbot avatar Jul 18 '25 09:07 aiojbot

This is the activity log of the api being created via yaml (successful): Image

This is the activity log of the api being created via cli (incorrect): Image

Not sure if the api-name being the base-path name is significant, it may not be, but that's a clue.

shazron avatar Jul 18 '25 10:07 shazron

The api-name issue above is a red-herring.

Found the issue with the command - it's two things:

  1. the action name must be fully qualified with the package, if not it will 404: e.g. my-package/my-action
  2. the command does not actually verify if the action exists, not sure if it should (it would have caught this issue)

shazron avatar Jul 18 '25 11:07 shazron

The API can't be tested right away, we need to wait 5 mins, so the user can't verify if it works. Also there is no action check here on the server itself, so a non-existent action can be set as an API.

shazron avatar Jul 21 '25 17:07 shazron