Skip to content
Playground(another site)

bynk.http.cors_unknown_field

Error A cors { } policy declares a field outside the closed set.

A cors { } policy has four fields: origins, headers, credentials and maxAge. The set is closed, so a misspelt or invented field is refused rather than ignored, which would leave the policy different from the one you wrote. Access-Control-Allow-Methods is not a field: the compiler derives it from the service's routes. Rename the field or delete it. A field with the wrong kind of value is bynk.http.cors_invalid_field.

Example

cors { origins: ["https://app.example.com"], methods: ["GET"] } // ✗ not a field, methods come from the routes
cors { origins: ["https://app.example.com"], maxAge: 1.hour } // ✓

In the Book

See also

  • Every code in its category, HTTP, on the diagnostic index.
  • bynk explain bynk.http.cors_unknown_field shows the same from the installed toolchain, without a network.