-
Goal: I am trying to set my lambda function name based on whether i'm on production or staging.
-
Details: I'm trying to use a ternary operator to set my lambda function name, when i select the function name from the dropdown there is no problem, the function runs fine. It's only when i use the ternary operator that the function isn't called and ReTool returns a 'unknown error' message.
-
Screenshots:
Hi @jeevenugo ,
The ternary operator looks correct to me. I replicated a similar example, and the functionality you’re trying to implement worked fine on my end. I suspect the issue might be on the AWS side.
To help debug this, could you try the following steps?
- Open the browser console to check for any errors.
- Check the AWS Lambda logs to see if there’s an internal error with the Lambda function.
As a workaround, since you mentioned the dropdown button is working correctly, you can try this approach:
- Create two Lambda resources (e.g.,
assignCard
andassignCardDev
) instead of just one. Use the dropdown selector when choosing the function name, and assign theassignCard
function to one resource, andassignCardDev
to the other. - Create two event handlers in the component that’s invoking the Lambda function. Each event handler should call one of the Lambda functions.
- Use the “Only run when” parameter to ensure the correct function runs in the appropriate environment.
Here’s an example to guide you:
Hope this helps! Let me know if you need more details.
Hi @gonzalo,
My implementation started working for a bit and now broke down again. Please take a look at my setup:
This query calls parseSuperpassInvoice
This is parseSuperpassInvoice
Here is the console output:
Hey @jeevenugo! Based on @gonzalo's testing, it's really hard to determine what might be happening here.
My recommendation is to do one of the following two things:
- Consolidate your three existing lambda functions into one and handle the logic there.
- Create three separate versions of the
parseSuperpassInvoice
query, one for each environment, and add them all as success callbacks touploadSuperpassInvoice
. Dynamically disable all but one with the advanced configuration option.
I hope that helps!
Frustrating but sure. Thanks
Understandable! I'm not going to drop this just yet, as this implementation should obviously work, but want to first prioritize a workaround in order to get you unstuck. When you get a chance, can you share the body of the failing request as it appears in the "Network" tab of your browser dev tools?