Upsert - [GraphQL] Error: undefined argument

Hi all. I'm trying to upsert shopifyBulkOperation records, but I'm getting the error [GraphQL] Error: undefined argument. I'm not sure what I'm missing here?
No description
14 Replies
Chocci_Milk
Chocci_Milk7mo ago
Hello, You need to pass the on option in order for us to know on what field to base the upsert. Unless you're trying to upsert on the id Could you please share the traceId for the error? Do you have more than one unique field on the model/a unique field with scoped by? I'm not able to reproduce this on my end
RenanVSouza
RenanVSouzaOP7mo ago
@Chocci_Milk I've tried, same result. Other than the shopify fields, the only extra field is a "belongs to" relationship with another model (localBulkOperation) Traceid: 1fd51b9a31ff4fdcba4cbb28be09a66b
No description
Chocci_Milk
Chocci_Milk7mo ago
From what I can tell, the error is saying that you're missing a field that looks to be required. I just can't figure it out. Let me dig a tiny bit
ljspoor94
ljspoor947mo ago
If you have an ID, why can't you just use the update action?
Chocci_Milk
Chocci_Milk7mo ago
Thats a thought but I want to get to the bottom of why this is happening Its weird cause my logs say that this action is a background action and global action but I don't see that being the case in your code
RenanVSouza
RenanVSouzaOP7mo ago
@Chocci_Milk it's being called from a global action - bulkGeneration/createShopifyBulkOperation @ljspoor94 the reason is that this is called after I send a mutation to Shopify to create a bulk operation, which gives me the operation ID. So the create webhook might or might not have arrived to create the record yet
Chocci_Milk
Chocci_Milk7mo ago
Are you enqueuing that global action?
RenanVSouza
RenanVSouzaOP7mo ago
Yes
Chocci_Milk
Chocci_Milk7mo ago
Mind if I run the upsert on your api playground myself?
RenanVSouza
RenanVSouzaOP7mo ago
Sure, go ahead
Chocci_Milk
Chocci_Milk7mo ago
Do you mind if I try converging your Shopify connection? It will bring back deleted fields Idk, if you have deleted fields in the past
RenanVSouza
RenanVSouzaOP7mo ago
If it only affects the bulk-refactor environment, no problem at all
Chocci_Milk
Chocci_Milk7mo ago
Nope, didn't change a thing Ok, I just found that the create/update actions work. Would you be able to run your own upsert logic for the time being? Check that the value exists and run create/update accordingly I think that there's an issue with the upsert API I've made a ticket and sent it over to one of our engineers. Sorry for the inconvienience
RenanVSouza
RenanVSouzaOP7mo ago
Ok no problem. Please let me know once it's fixed so I can update the code

Did you find this page helpful?