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

Payload not updated when using request.error filter #17002

Closed
llindemann opened this issue Jan 3, 2023 · 3 comments · Fixed by #18137
Closed

Payload not updated when using request.error filter #17002

llindemann opened this issue Jan 3, 2023 · 3 comments · Fixed by #18137
Labels

Comments

@llindemann
Copy link

Describe the Bug

When updating the payload in a flow or an extension using the request.error filter, the changes are discarded

To Reproduce

The following script should prevent fields with a must be [null] validation to display an error message to the user:

module.exports = async function(data) {
	if (Array.isArray(data.$trigger.payload?.errors)) {
			const errors = data.$trigger.payload.errors.filter(a => !a.message.includes('" must be [null]'))
            return {errors}
	}
    return {};
}

But the error message is displayed to the user.

Errors Shown

No response

What version of Directus are you using?

9.22.1

What version of Node.js are you using?

16.16.0

What database are you using?

SQLite 3.40.0

What browser are you using?

Safari

How are you deploying Directus?

running locally

@github-actions
Copy link

github-actions bot commented Jan 3, 2023

Linear: ENG-378

@br41nslug
Copy link
Member

This should have either been an action or should ahve have updated its output, nice catch 😄

@llindemann
Copy link
Author

From what I gather, this is due to a small bug in the error-handler, corrected by #17003. It works for my use cases, but maybe I miss some side effects

hanneskuettner pushed a commit to hanneskuettner/directus that referenced this issue Apr 18, 2023
meditadvisors pushed a commit to ciso360ai/directus-mod that referenced this issue May 13, 2023
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Feb 1, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
2 participants