Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Why am I getting this error when trying to install the plugin? config.<field name>:unknown field,config: <filed name>:"required field missing #782

Closed
elrobertcharle opened this issue Oct 26, 2022 · 9 comments

Comments

@elrobertcharle
Copy link

elrobertcharle commented Oct 26, 2022

lua.schema:

local typedefs = require "kong.db.schema.typedefs"


return {
  name = "asheauth",
  fields = {
    {
      route = typedefs.no_route,
    },
    {
      service = typedefs.no_service,
    },
    {
      consumer = typedefs.no_consumer,
    },
    {
      protocols = typedefs.protocols_http,
    },
    {
      config = {
        type = "record",
        fields = {           
            { uncontrolled_routes = { type = "array", required = false, elements = { type = "string" } }, },
            { authorization_route = { type = "string", required = true}}
        },
      },
    },
  },
}

Trying to install plugin globaly:

Request:

POST http://localhost:8001/plugins HTTP/1.1
User-Agent: Fiddler
Content-Type: application/json
Host: localhost:8001
Content-Length: 101

{"name":"kong-asheauth",
"protocols":["http"],
"config.authorization_route":"123",
"enabled":true}

Response:

HTTP/1.1 **400 Bad Request**
Date: Wed, 26 Oct 2022 08:53:38 GMT
Content-Type: application/json; charset=utf-8
Connection: keep-alive
Access-Control-Allow-Origin: *
Content-Length: 278
X-Kong-Admin-Latency: 5
Server: kong/3.0.0

{"fields":{"config.authorization_route":"unknown field","config":{"authorization_route":"required field missing"}},"message":"2 schema violations (config.authorization_route: required field missing; config.authorization_route: unknown field)","name":"schema violation","code":2}
@GGabriele
Copy link
Collaborator

GGabriele commented Oct 26, 2022

Hi @elrobertcharle ,

can you please include some more details? What's the configuration you are trying to sync? What is the decK command you are using? What is the decK and Kong version you are running?

The returned error is stating that the request is missing the required authorization_route configuration field.

@elrobertcharle
Copy link
Author

elrobertcharle commented Oct 26, 2022 via email

@elrobertcharle
Copy link
Author

the kong.config:

log_level = debug

plugins = bundled,kong-asheauth

@elrobertcharle
Copy link
Author

The returned error is stating that the request is missing the required authorization_route configuration field.

As you can see in the request for install the plugin I sent the authorization_route field with "123" value

@elrobertcharle
Copy link
Author

I'm using Kong with DB

@GGabriele
Copy link
Collaborator

Sorry, I meant the decK config file you are using. How are you running decK?

@elrobertcharle
Copy link
Author

I think I'm not using decK because I am using Kong with DB, correct me if I'm wrong

@GGabriele
Copy link
Collaborator

Oh okay, then please open an issue here: https://github.com/Kong/kong/issues/new/choose
That's better suited for Kong-related issues.

@elrobertcharle
Copy link
Author

Ok, thank you

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants