You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I found an issue, maybe is on the user's side, but the query is very simple and i don't understand why this could break.
Executing a couple of insertAndFetch in simultaneous. Using Promise.map from bluebird.
The thing is that for the first one reach the insertAndFetch, all is good.
The next three iterations, the error appears: Error: undefined passed as an item in argument #1 for 'whereInComposite' operation. Call skipUndefined() method to ignore the undefined values.
Always keeping the Promise.map from bluebird. Of course that if i change it to Promise.mapSeries which is not doing anything simultaneously, it worked as well.
Also, there are some inserts repeated, it means that it is entering to the onConflict("isin").ignore() part.
Can you help me?
Maybe it's a missing thing on the user side that I'm not addressing
Thanks in advance
The text was updated successfully, but these errors were encountered:
@brunorota0 We also ran into this. I assume that what's happening inside Objection is that when onConflict is used the insert part of insertAndFetch doesn't fail if the row already exists, but the subsequent fetch which is a new query doesn't have the result it needs from the insert if the insert didn't return anything, so the fetch fails.
As mentioned here you can use returning (at least for Postgres) as an alternative:
Which will prevent the error you're seeing, but unlike returning('*') suggests the resulting object will only have the fields you passed to the insert, which is different from insertAndFetch:
letresult=awaitMyEntity.query().insertAndFetch({key: 'value'}).onConflict('key').ignore();console.log(result.id);// 1// this will errorawaitMyEntity.query().insertAndFetch({key: 'value'}).onConflict('key').ignore();result=awaitMyEntity.query().insert({key: 'value'}).onConflict('key').ignore().returning('*');console.log(result.id);// undefinedconsole.log(result.key);// value
TLDR neither is ideal (unless this behavior has changed in a more recent version). If you're using a transaction anyway the best version is probably using separate insert and fetch like you did in the example that worked.
Hey guys,
I found an issue, maybe is on the user's side, but the query is very simple and i don't understand why this could break.
Executing a couple of
insertAndFetch
in simultaneous. UsingPromise.map
frombluebird
.The thing is that for the first one reach the
insertAndFetch
, all is good.The next three iterations, the error appears:
Error: undefined passed as an item in argument #1 for 'whereInComposite' operation. Call skipUndefined() method to ignore the undefined values.
The query:
The model:
I tested it doing two queries and it worked!
Always keeping the
Promise.map
from bluebird. Of course that if i change it toPromise.mapSeries
which is not doing anything simultaneously, it worked as well.Also, there are some inserts repeated, it means that it is entering to the
onConflict("isin").ignore()
part.Can you help me?
Maybe it's a missing thing on the user side that I'm not addressing
Thanks in advance
The text was updated successfully, but these errors were encountered: