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
createMany method triggers the create hook before the item is created #11353
Comments
While the reproduction steps are a little different, the root cause of this issue should be the same as #11172. |
@nickrum I read through #11172, and I have updated my code. The function getPermission(context) {
const schema = context.schema;
const accountability = context.accountability;
const knex = context.database;
return { knex, schema, accountability };
} Now, when the following code runs, I can see 4 out of the 5 items printed out. const b = await getBById(services, permission, id);
console.log(b); The 5th item is not printed, and I get the following error message.
|
3 tasks
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Preflight Checklist
Describe the Bug
The
createMany
method ofItemsService
triggers the create hook on the item before the item is created in the table.To Reproduce
a
andb
.b
items whena
item is created.Errors Shown
This should print the item the create hook was triggered on. But, I get
undefined
here. If I wait for, say 100 ms, before callinggetBById
, I get the correct item printed on the terminal.Note:
If I print the
meta
object before runninggetBById
, I am able to see thekey
field in it.What version of Directus are you using?
9.5.0
What version of Node.js are you using?
14.18.3
What database are you using?
PostgreSQL 13.4
What browser are you using?
Firefox 95.0.2
What operating system are you using?
Fedora 34
How are you deploying Directus?
Locally
The text was updated successfully, but these errors were encountered: