尝试在 Kong 中创建前置函数时出错

Error attempting to create a pre-function in Kong

当我尝试在 Kong 中创建前置函数(无服务器)时出现以下错误:

"cannot create 'plugins' entities when not using a database"

我目前使用的是版本 1.1.1 的 Alpine 容器,我已将其配置为无数据库操作。无数据库设置的文档表明,只要函数不尝试连接到数据库,我应该没问题,但系统本身与文档相矛盾。现在,脚本只是一个导入语句。

关于这方面我可能遗漏了什么,还是我必须返回使用数据库进行配置?

如您在 kong documnet here 中所见:

Since the only way to configure entities is via declarative config, the endpoints for CRUD operations on entities are effectively read-only in the Admin API when running Kong in DB-less mode.

当 运行 Kong 处于无数据库模式时,您只能对 Admin Api 使用 GET 方法。所以创建一个插件实体是用 POST 方法会出错。

要添加kong实体吗?关注 The Declarative Configuration Format. Then import to Kong by HTTPie method (Loading The Declarative Configuration File)

$ http :8001/config config=@kong.yml