Lambda 'Unknown Error' when computing function name

  • 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?

  1. Open the browser console to check for any errors.
  2. 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:

  1. Create two Lambda resources (e.g., assignCard and assignCardDev) instead of just one. Use the dropdown selector when choosing the function name, and assign the assignCard function to one resource, and assignCardDev to the other.
  2. Create two event handlers in the component that’s invoking the Lambda function. Each event handler should call one of the Lambda functions.
  3. Use the “Only run when” parameter to ensure the correct function runs in the appropriate environment.

Here’s an example to guide you:
Screenshot 2024-09-18 at 10.55.21 AM

Screenshot 2024-09-18 at 11.01.39 AM

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! :wave: 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:

  1. Consolidate your three existing lambda functions into one and handle the logic there.
  2. Create three separate versions of the parseSuperpassInvoice query, one for each environment, and add them all as success callbacks to uploadSuperpassInvoice. Dynamically disable all but one with the advanced configuration option.

I hope that helps!

Frustrating but sure. Thanks

1 Like

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?