由于名称冲突无法创建操作,但没有现有操作具有此名称?

Unable to create action due to name clash but no existing action has this name?

从命令行创建新的 OpenWhisk 操作,返回以下错误。

$ wsk action create hello index.js
error: Unable to create action 'hello': Resource by this name exists but is not in this collection. (code 4923976)
Run 'wsk --help' for usage.

查看已部署的操作,我没有看到另一个同名操作。

$ wsk action list
actions
/user@email.com_dev/example                                   private nodejs:6
/user@email.com_dev/hello_world                               private nodejs:6
/user@email.com_dev/testing                                   private nodejs:6

导致此错误消息的原因是什么?

操作、触发器和规则名称在命名空间和包中必须是唯一的。

如果没有使用此标识符的操作,请检查名称为 hello 的触发器和规则。

这里有一个示例,说明操作、触发器和规则在使用相同名称时会发生冲突。

$ wsk trigger create clash
ok: created trigger clash
[17:41:41 /private/tmp]$ wsk action create clash index.js
error: Unable to create action 'clash': Resource by this name exists but is not in this collection. (code 5000008)
Run 'wsk --help' for usage.
[17:41:54 /private/tmp]$ wsk trigger delete clash
ok: deleted trigger clash
[17:42:06 /private/tmp]$ wsk action create clash index.js
ok: created action clash

可以通过为操作名称使用不同的标识符或重命名冲突资源来解决此错误。也可以在包内移动操作,以停止与全局工作区中的资源发生冲突。