adobe / adobe/aio-cli-plugin-runtime

`aio rt trigger create` fails to create a trigger with a feed from /whisk.system/alarms package

Open
#269 13 comments 0 reactions 0 assignees View on GitHub
bug
Dominant language
JavaScript
Stars
21
Forks
33
PR merge metrics
No merged PRs in 30d

Description

**Describe the bug**
Creating a trigger that has a feed (any of the alarms package feeds) fails with a `Feed name is not valid` error.

**Example command failing with an error**
```
$ aio rt trigger create my-trigger -f /whisk.system/alarms/once -p date "2022-10-26T11:00:00.000Z" -v
2022-10-26T10:25:23.920Z aio-cli-plugin-runtime {
apiversion: 'v1',
apihost: 'https://adobeioruntime.net',
namespace: '******************',
api_key: ''******************'
}
2022-10-26T10:25:23.920Z @adobe/aio-lib-runtime:RuntimeAPI:debug init options: {
"apiversion": "v1",
"apihost": "https://adobeioruntime.net",
"namespace": "'******************",
"api_key": "'******************"
}
2022-10-26T10:25:23.922Z @adobe/aio-lib-runtime:RuntimeAPI:debug proxy settings not found
2022-10-26T10:25:25.344Z aio-cli-plugin-runtime OpenWhiskError: PUT https://adobeioruntime.net/api/v1/namespaces/******************/triggers/my-trigger Returned HTTP 400 (Bad Request) --> "Feed name is not valid"
at (...)
» Error: failed to create the trigger: feed name is not valid (400 Bad
» Request)
» specify --verbose flag for more information
```
_namespace and APi key obfuscated_

This looks like related to a leading slash, as the same command executed with `wsk cli` works:
```
$ wsk trigger create my-trigger -f whisk.system/alarms/once -p date "2022-10-26T11:00:00.000Z"
ok: invoked /whisk.system/alarms/once with id 3de991f748c94834a991f748c9783431
{
"actionHost": "10.216.0.50",
"activationId": "3de991f748c94834a991f748c9783431",
"annotations": [
{
"key": "path",
"value": "whisk.system/alarms/once"
},
{
"key": "waitTime",
"value": 128
},
{
"key": "kind",
"value": "nodejs:10"
},
{
"key": "timeout",
"value": false
},
{
"key": "limits",
"value": {
"concurrency": 1,
"logs": 10,
"memory": 256,
"timeout": 60000
}
},
{
"key": "initTime",
"value": 158
}
],
"duration": 2277,
"end": 1666781688181,
"invokerInstanceId": {
"instance": 4,
"instanceType": "invoker",
"uniqueName": "rt-invoker-4",
"userMemory": "1500000000000000 B"
},
"logs": [],
"name": "once",
"namespace": "******************",
"podName": "wskrt-invoker-44-370593-prewarm-nodejs10",
"publish": false,
"response": {
"result": {
"status": "success"
},
"size": 20,
"status": "success",
"success": true
},
"start": 1666781685904,
"subject": "******************",
"version": "0.0.245"
}
ok: created trigger my-trigger
```

Trying to use `aio cli trigger create` without the leading slash generates another error `The requested resource does not exist`
```
$ aio rt trigger create my-trigger -f whisk.system/alarms/once -p date "2022-10-26T11:00:00.000Z" -v
(...)
2022-10-26T10:40:22.974Z @adobe/aio-lib-runtime:RuntimeAPI:debug proxy settings not found
2022-10-26T10:40:26.448Z aio-cli-plugin-runtime OpenWhiskError: POST https://adobeioruntime.net/api/v1/namespaces/******************/actions/alarms/once Returned HTTP 404 (Not Found) --> "The requested resource does not exist."
at (...)
» Error: failed to create the trigger: the requested resource does not
» exist. (404 Not Found)
» specify --verbose flag for more information

```

Note that in addition the working command does not align with the documentation which instructs to provide leading slash.
Documentation examples:
* [creating trigger using wsk cli](https://developer.adobe.com/runtime/docs/guides/reference/prepackages/)
* [creating trigger using app builder manifest file](https://developer.adobe.com/app-builder/docs/resources/cron-jobs/lesson2/)

**Expected behavior**
The `aio cli trigger create ` works as documented.
The App Builder app deployment (`aio app run`) works as well and allows to create triggers along actions during deployment.

**Versions:**
- OS: Windows 10 Pro
- aio cli: 9.1.0
- wsk cli: 1.2.0-windows-386
- node: 14.17.0

Contributor guide

Open the contributing guide

Research direction

Start by tracing the `aio rt trigger create` command and its feed handling, using the failing `/whisk.system/alarms/once` example and the working `wsk` command as a comparison. Verify the behavior for feed names with and without a leading slash, then confirm that the documented command works and that App Builder deployment behavior remains intact.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
cli
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.