Search code examples
kongkong-plugin

Error attempting to create a pre-function in Kong


I'm getting the following error when I attempt to create a pre-function (serverless) in Kong:

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

I'm currently using a version 1.1.1 Alpine container and I have it configured for DB-less operation. The documentation for the DB-less setup indicates that as long as the function doesn't try to connect to the database I should be fine, but the system itself is contradicting the documentation. Right now, the script is just an import statement.

Is there something I may be missing regarding this or do I have to go back to use the database for configuration?


Solution

  • As you see in 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.

    You could only use GET method for Admin Api when running Kong in DB-less mode. So creating a plugin entity is with POST method will get error.

    Want to add entities of kong? just follow The Declarative Configuration Format. Then import to Kong by HTTPie method (Loading The Declarative Configuration File)

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