Issue with taskId Missing from params in Custom Action

I created a custom action called updateRank in shopifyCustomer. The params received by this action are specified as follows: export const params = { taskId: { type: "string" }, }; However, when executing the action as shown below, the console log of the params only contains the id, and the taskId is not being retrieved. I have confirmed through the logs on the execution side that taskId is a string. const { result } = await gadgetApi.shopifyCustomer.updateRank(customerId, { taskId: taskId }); In the playground, both id and taskId were successfully included in the params using the following method. const shopifyCustomerRecord = await api.shopifyCustomer.updateRank("5883275935793", { taskId: "456", }); console.log(shopifyCustomerRecord) The documentation I referred to is as follows. Each document provides different instructions. https://docs.gadget.dev/guides/actions/code#adding-params-to-model-actions await api.student.suspend({ id: "123", suspensionLength: 3 }); https://docs.gadget.dev/api/rw-ranky/dev/schema/shopifyCustomer#shopifycustomer-updaterank const shopifyCustomerRecord = await api.shopifyCustomer.updateRank("123", { taskId: "example value for taskId", }); I’m struggling to identify the root cause of the issue and would greatly appreciate your assistance.
13 Replies
Chocci_Milk
Chocci_Milk8mo ago
Hello, Has this issue been dealt with? If not, could you please share the URL of the application so that I can take a closer look? There are only a couple of reasons why this could be happening
Aya
AyaOP8mo ago
Hello! No, it hasn't 😥 The app URL is https://rw-ranky.gadget.app.
Chocci_Milk
Chocci_Milk8mo ago
Have you tried logging with the logger in this fashion?
logger.info({taskId: params.taskId}, "TaskId")
logger.info({taskId: params.taskId}, "TaskId")
According to the code, all should work.
Chocci_Milk
Chocci_Milk8mo ago
I went ahead and tested it on your app and it worked:
No description
Chocci_Milk
Chocci_Milk8mo ago
I tested from the API Playground
Aya
AyaOP8mo ago
No, I haven't. And I tried the same, but taskId isn't included in the logs. When I tested from the API Playground, it worked even if console.log is console.log('onSuccess params', params);. 🤔
No description
Aya
AyaOP8mo ago
We execute the action from AWS with that same code. I can't find the difference between it and the Playground 🤔 FYI, the traceIds in the screenshot above are: 83e7f8662e4e5393457a8fd157fd5a79 38791395754f679ce141075836e1e421 2c2d4d65d1e6c6ab0ce59a7811c38be6 5528d9e399970b754e32fb05714f154d 64df6226b51b1b3b1c58cf9bc1e976d1 eabc4b4e503182975e3e2bc909a55c0f 0f407256a6d3c9200dd1fd48571b3bf8
Chocci_Milk
Chocci_Milk8mo ago
In AWS, do you have the latest version of your API package installed?
Aya
AyaOP8mo ago
We updated it to the latest when we started to fix it. The version is “@gadget-client/rw-ranky”: “^1.18044.0".
Chocci_Milk
Chocci_Milk8mo ago
Are these calls being made from an external source or is it internally to your application?
Aya
AyaOP8mo ago
These are from an external source . updateRank is called from AWS to do queuing ( It was developed before the Background Action was released ) We plan to change this architecture, but for now, we have to rely on calls from AWS.
Chocci_Milk
Chocci_Milk8mo ago
Ok, you definitely need to make sure that the package is updated any time you make a change to your application in Gadget. The error you're getting is a client side error. Here are some docs on how to update the package verison: https://docs.gadget.dev/api/example-app/development/external-api-calls/installing#updating-the-npm-package
Aya
AyaOP8mo ago
It's solved! 🙌
We'd used npm install @gadget-client/rw-ranky We need to use npm install @gadget-client/rw-ranky@latest-dev Thank you😊

Did you find this page helpful?