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

bug: 500 Error when using non-existing attribute in uniqueness_constraints #4677

Closed
BeArchiTek opened this issue Oct 14, 2024 · 2 comments
Closed
Assignees
Labels
type/bug Something isn't working as expected

Comments

@BeArchiTek
Copy link
Contributor

BeArchiTek commented Oct 14, 2024

Component

infrahubctl

Infrahub version

0.16.3

Current Behavior

When defining a schema with a node that includes auniqueness_constraints field referencing a non-existing attribute, the system throws an internal server error (500).

Ideally, the system should provide a validation error or a clear message explaining that the referenced attribute does not exist.

Expected Behavior

The system should validate the schema and return a descriptive error message

Steps to Reproduce

Using the schema below with auniqueness_constraints, referencing an attribute that does not exist in the node's attributes list.

version: '1.0'

nodes:
  - name: Test
    namespace: Random
    attributes:
      - name: name
        kind: Text
    uniqueness_constraints:
      - ["non_existing_attribute__value"]

Load the schema.

The server returns a 500 error.

> infrahubctl schema load test-schema.yml
HTTP communication failure: Server error '500 Internal Server Error' for url
'http://localhost:8000/api/schema/load?branch=main'
For more information check:
https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500 on POST to
http://localhost:8000/api/schema/load?branch=main

Additional Information

No response

@BeArchiTek BeArchiTek added the type/bug Something isn't working as expected label Oct 14, 2024
@ogenstad
Copy link
Contributor

This looks like a backend bug.

@ogenstad
Copy link
Contributor

Fixed in #4690.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type/bug Something isn't working as expected
Projects
None yet
Development

No branches or pull requests

2 participants