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

When collection settings specify a non-existent hook, documents endpoint silently fails #559

Open
ohmoses opened this issue Jun 18, 2019 · 0 comments

Comments

@ohmoses
Copy link

ohmoses commented Jun 18, 2019

When a hook is specified in collection settings and there is no code for such a hook provided in the hooks directory, the collection's endpoint returns an empty response body.

This line is a good starting point for a solution.

Steps to replicate

Using the sample API config in the repo ⇒ collection reference has

    "hooks": {
      "afterGet": ["check-reference"]
    }

Accessing /vjoin/testdb/reference?compose=true&fields={}&filter={}&sort={"name":1} (e.g. clicking on "reference" in the header in Publish) gives an empty response body, crashing Publish.

Expected behavior

Ideally, the API should throw an error on start. Less ideally, probably return a meaningful error object in the response.

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

No branches or pull requests

1 participant