Undefined Variable Issue Alexa

Hey All,

I am working on a project where I am looking up the latest swimming conditions for a beach that the user specifies. The general workflow is this:

First Assistant asks user what beach they are interested in.

Next the user says the beach name and the assistant uses an API search to match the utterance to an index of beaches with ids.

If there is a result, the assistant asks the user to confirm if the beach matches their desired one by speaking back the beach it found.

What is super odd is that when I do this on VF it works perfectly but when I’m testing in the Amazon Actions Console Alexa keeps saying: “I found you the beach of undefined”.

I have tested with debug mode and I see all the variables displaying. The API request seems to be putting all the correct data into the variables.

For example Beach Capture does a capture and stores the users response to a variable called: {swim_guide_site}. Next the API request uses that variable to hit a beach index endpoint that returns a match. If there is a match I am storing the beach name and id in a the following variables: {sg_result1} - this is the beach name, and {sg_id}. There is an If statement that helps control the flow in the event there are no results coming back. If there is a result, the assistant should say I found the following site for you: {sg_result1}. Is this the site you’re interested in? Again works fine on VF but it replaces sg_result1 with undefined in Actions console.

Is there something I am missing here? I’ve attached a screenshot of the project for help and appreciate anything you all could support me with.

Have you tried to insert speech blocks at key points in your flow to read off your variable? This could help you narrow down where exactly in your flow the problem is occuring.

Nice use-case by the way. I could certainly use this for the pool I go to.

Terry