Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can you please fix the item mapping. #7

Closed
bkarakashev opened this issue Dec 8, 2017 · 21 comments
Closed

Can you please fix the item mapping. #7

bkarakashev opened this issue Dec 8, 2017 · 21 comments

Comments

@bkarakashev
Copy link

Can you please fix the item mapping.
So when specified ID: in the products.yml file it picks it up.

@onegambler
Copy link
Owner

Hi @bkarakashev ,

Thank you for finding this bug. It was related to string casing. I pushed a fix it and it should work, unfortunately the product list needs to be rebuilt with gulp build-assets.

Do let me know if you still have problems.

Many thanks,
Roberto

@bkarakashev
Copy link
Author

Hey Roberto,

Still having the problem.
I am trying to map "bread" to this product ID: '285529221' which is "Kingsmill 50/50 Sandwich Thins 6 Pack"
So I change the products.yml file to this
- bread:
id: '285529221'
but I am still getting this:
https://www.tesco.com/groceries/en-GB/products/256174499
Which is the wrong product.

I have run the gulp build-assets and then gulp build to generate the zip file.
Upload the new Zip file to Lambda and ask Alexa to add bread to my shopping list.
But when I check in my basket all I see is the wrong bread '256174499'.

Am I doing something wrong?

Regards
Blago

@onegambler
Copy link
Owner

onegambler commented Dec 10, 2017

Hi Blago,

Is id indented?

It should be

    - blueberries:
        id:
    - bread:
        id: '279505857'
    - bread crumbs:
        id:

as it's a yaml file needs to be properly indented (8 spaces from the beginning of the line, no tabs). See here.

If that's correct, can you please send me the generated products.json bit containing bread? It's in dist/data/products.js after running gulp build-assets.

Based on your yaml file, it should look like this:

{
  ...
  "bread": "285529221",
  ...
}

Let me know; I tried your configuration on my alexa skill and it adds the correct product.

Roberto.

@bkarakashev
Copy link
Author

Hello Roberto,

I've checked everything my yml file is correct my JSON file is also correct.
yml file
"bread": "285529221",
Can you please try mapping your bread with this product ID: 285529221 and let me know if that adds Kingsmill 50/50 Sandwich Thins 6 Pack.

Thanks
Blago

@onegambler
Copy link
Owner

Hi Blago,

That's very weird. I tried to change my products.yaml with your id and I do manage to add that to the basket.

This is my IFTTT activity log, which you can find here:

image

As you can see I have the id in Value1. Could you have a look at your last execution and check what you're sending to IFTTT in the same field?

Another thing to do, once updated the new zip, can you see the changes if you use the edit code inline? It would still be under data/products.json.

Something I noticed is that if you are using gulp build with a windows machine, the zip file for some reason doesn't work properly once uploaded to aws. So another thing you could try, once ran gulp build is to go to the dist folder, select all the files (not the folder itself) and zip it manually.

I hope it helps! I want to get to the bottom of this! :)

Roberto

@bkarakashev
Copy link
Author

Hi Roberto,

For some reason when I go to my IFTTT My Applets and then I check the Webhook it shows me that it never runs.
screen shot 2017-12-10 at 17 46 51
But if I go to Tesco integration I can see it run.
screen shot 2017-12-10 at 17 47 33
screen shot 2017-12-10 at 17 48 03

Any idea what am I missing... and why my Webhook never get triggered?

Thanks
Blago

@bkarakashev
Copy link
Author

When I click on View activity log for the Tesco integration this is what I see there:
screen shot 2017-12-10 at 17 50 50

@onegambler
Copy link
Owner

I think I know the problem. You are using the wrong applet! As you can see it says Alexa, add __ to my shopping list (adds to Tesco basket too). It should be something like If maker Event "tesco_search", then search and add. So it's using the default IFTTT trigger: whenever you add a product to alexa shopping list.. it will add it to the tesco basket. It's not actually triggering my skill. My skill should be triggered by saying Alexa ask Tesco to add bread and not alexa add bread to the shopping list.

That's why you can't use the id.

Have you followed my instructions on how to create the applet and alexa skill? You are supposed to use a webhook for the +this part. Also, make sure you have these 3 environment variables in your lambda

  • APP_ID: It's the lambda identification string, it's not a mandatory parameter, but it makes a little bit more secure by making your lambda only accept requests from your specific skill. It can be found in the Alexa Skill set up page.
  • IFTTT_URL: It's the IFTTT webhook url. It should be https://maker.ifttt.com/trigger
  • IFTTT_KEY: It's the IFTTT KEY saved before

What I can suggest is to go through the README again and double check you did all the steps and when testing with alexa remember to say Alexa, ask Tesco....

Let me know if you manage to get it working or you need more help with the instructions, I'm happy to help.

Roberto

@bkarakashev
Copy link
Author

bkarakashev commented Dec 10, 2017

Hey Roberto,

I think I was using the IFTTT Tesco skill before.
So now I've removed it and followed your instructions.
I have recreated the Webhook and now is using the Lambda.
But unfortunately is failing.
screen shot 2017-12-10 at 20 29 17
There is no much in the Lambda logs.
screen shot 2017-12-10 at 20 30 54
Not sure why is not working for me :(
Also, the Webhook didn't run.
screen shot 2017-12-10 at 20 35 13

Thanks
Blago

@bkarakashev
Copy link
Author

If I say "Alexa, open Tesco" it tells me "I am not sure what went wrong"
Something is wrong with my Skill maybe.

@bkarakashev
Copy link
Author

I've created my Tesco Skill in the US. because I've changed my Amazon account to the US as there are more Skils for Alexa. But my AWS account and Lambda function are created in Irland.
Do you think this may be a problem?

@onegambler
Copy link
Owner

Cool. That's one step forward :)

Before doing anything, the fact that you don't see any log it means the code never actually ran.

As I mentioned before, I noticed is that if you are using gulp build with a windows machine, the zip file for some reason doesn't work properly once uploaded to aws. So one thing to try, once ran gulp build is to go to the dist folder created, select all the files (not the folder itself) and zip it manually.

You can try uploading my dist.zip and see if it works. If it doesn't there's still something misconfigured in the lambda.

Roberto
.

@bkarakashev
Copy link
Author

So I have added products.json as an event and clicked Test in the Lambda UI.
And this is the error I am getting:
screen shot 2017-12-10 at 20 57 00

@onegambler
Copy link
Owner

Yeah, I'm pretty sure the problem is related to how the files have been zipped.

http://docs.aws.amazon.com/elasticbeanstalk/latest/dg/applications-sourcebundle.html#using-features.deployment.source.gui

Can you try to zip it manually? Selecting the files and not the folder.

@bkarakashev
Copy link
Author

bkarakashev commented Dec 10, 2017

I've uploaded the code using Serverless and this didn't work as well :(

@bkarakashev
Copy link
Author

You can see all the files are there:
screen shot 2017-12-10 at 22 29 03

@onegambler
Copy link
Owner

Hi,

I'm pretty sure the problem is related with the zipped file and folders permissions. As you can see here:

And this is the thread about the problem, using gulp-zip and windows machines

The fact that you see the files doesn't matter, the problem is around folder permissions. Have you tried to manually zip the files and upload it? http://docs.aws.amazon.com/elasticbeanstalk/latest/dg/applications-sourcebundle.html#using-features.deployment.source.gui

Otherwise you could try to upload my zip file and see if it works and then change the products.json manually on AWS console. dist.zip

Roberto

@bkarakashev
Copy link
Author

I think we have progress here. :)
Before when I ask Alexa about Tesco it was crashing but now it knows about it and also when I've asked to add bread or milk it did it said I've added milk, bread...
But the items did not appear in my Tesco Basket. Also, the webhook didn't run.
So I've set up the env variables as per Read.me.

@bkarakashev
Copy link
Author

So after all its look like you where right about me not uploading the files properly :)
My apologies.
Now I need to find out why is not adding items to the basket and the clue is in the fact that it did not use the webhook :) but why.

@bkarakashev
Copy link
Author

I don't know what was it maybe I did copy the Webhook key wrongly but when I re-added all the values to the Lambda envs all worked like a charm :)
Thank you very much Roberto for been so helpful and so patient with me :)

@onegambler
Copy link
Owner

Cool, happy to hear you managed in the end!

Enjoy the skill :)

Roberto

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants