duckduckgo / zeroclickinfo-spice

DuckDuckGo Instant Answers based on JavaScript (JSON) APIs
https://duckduckhack.com/
Other
548 stars 942 forks source link

BitcoinAddress: QRCode Images not loading #2183

Closed moollaza closed 8 years ago

moollaza commented 9 years ago

https://duckduckgo.com/?q=1J6EZsQLTppftPTbqYbbRDYFJMW5Ex3Bqi&ia=bitcoinaddress

Seems like the image URLS aren't working. @biteasy have the URL's changed? Does the code need to be fixed?


IA Page: http://duck.co/ia/view/bitcoin_address

Mailkov commented 8 years ago

@moollaza The URL: https://www.biteasy.com/blockchain/addresses/1Biteasym3p5E4soZq8So6NjkjYugEnz2X/qrcode.jpg works.

relevant code on bitcoin_adress.js is:

normalize: function(item) {
    return {
        image: 'https://www.biteasy.com/blockchain/addresses/'+address.address+'/qrcode.jpeg',
        img_m: 'https://www.biteasy.com/blockchain/addresses/'+address.address+'/qrcode.jpeg'
    };
},
templates: {
    group: 'info',
    options:{
        content: 'record',
        item: 'basic_image_item',
        rowHighlight: true
    }
}

address.address is 1Biteasym3p5E4soZq8So6NjkjYugEnz2X so I think the url code is ok. I have a doubt: does basic_image_item require title ? In this code, title is not set.

The error is: https://images.duckduckgo.com/iu/?u=https%3A%2F%2Fwww.biteasy.com%2Fblockchain%2Faddresses%2F1Biteasym3p5E4soZq8So6NjkjYugEnz2X%2Fqrcode.jpeg&f=1 Failed to load resource: the server responded with a status of 500 (OK) 500 Internal Server Error

Is it a duckduckgo problem?

I have one problem to debug on codio with (duckpan server) this IA ... when I try it returns: Spice.failed() called by Spice with ID "bitcoin_address". Probably I need the apikey: DDG_SPICE_BITEASY_APIKEY

moollaza commented 8 years ago

I have a doubt: does basic_image_item require title ? In this code, title is not set.

It's not required, but we assume a description or title will be present.

You can see the template here: https://github.com/duckduckgo/duckduckgo-answerbar-templates/blob/master/item/basic_image_item.handlebars

@Mailkov it looks like this is a DDG problem. If you remove the images. subdomain, our image proxy works correctly:

https://duckduckgo.com/iu/?u=https%3A%2F%2Fwww.biteasy.com%2Fblockchain%2Faddresses%2F1Biteasym3p5E4soZq8So6NjkjYugEnz2X%2Fqrcode.jpeg&f=1

I have one problem to debug on codio with (duckpan server) this IA ... when I try it returns: Spice.failed() called by Spice with ID "bitcoin_address".

Hmm it should fallback to making the API call on one of our DDH Machines (ddh10, ddh9 ... ddh1.duckduckgo.com) so that things still work. Whats the terminal output from DuckPAN?

alolis commented 8 years ago

@moollaza , apologies, just saw your ping. Let me know if you need anything on my side

Mailkov commented 8 years ago

@moollaza this is the terminal output:

API key not found. Using DuckDuckGo's endpoint:                                                                                             
"https://ddh10.duckduckgo.com/js/spice/bitcoin_address/1Biteasym3p5E4soZq8So6NjkjYugEnz2X"                                                  
172.17.42.1 - - [17/Nov/2015:13:50:13 +0000] "GET /js/spice/bitcoin_address/1Biteasym3p5E4soZq8So6NjkjYugEnz2X HTTP/1.1" 200 29 "http://ferr
ari-parker.codio.io:1234/" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/46.0.2490.86 Safari/537.36"       
172.17.42.1 - - [17/Nov/2015:13:50:13 +0000] "GET /share/spice/bitcoin_balance/bitcoin_balance.css HTTP/1.1" 200 1443 "http://ferrari-parker
.codio.io:1234/" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/46.0.2490.86 Safari/537.36"                 
172.17.42.1 - - [17/Nov/2015:13:50:13 +0000] "GET /country.json HTTP/1.1" 200 17 "http://ferrari-parker.codio.io:1234/" "Mozilla/5.0 (X11; L
inux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/46.0.2490.86 Safari/537.36"                                                      
172.17.42.1 - - [17/Nov/2015:13:50:13 +0000] "GET /assets/flags/20/wt.png?v=4 HTTP/1.1" 200 1541 "http://ferrari-parker.codio.io:1234/" "Moz
illa/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/46.0.2490.86 Safari/537.36" 

After some tests I can say you that only ddh1, ddh2 and ddh3 return the api key !

I have a doubt: does basic_image_item require title ? In this code, title is not set.

It's not required, but we assume a description or title will be present.

Ok, I suggest to change the documentation https://duck.co/duckduckhack/templates_reference#codebasicimageitemcode-template title is setted as required.

alolis commented 8 years ago

@Mailkov , can you please try now? I think the problem was on biteasy side after all

Mailkov commented 8 years ago

@alolis the same error:

API key not found. Using DuckDuckGo's endpoint:                                                                                             
"https://ddh10.duckduckgo.com/js/spice/bitcoin_address/1Biteasym3p5E4soZq8So6NjkjYugEnz2X"                                                  
172.17.42.1 - - [17/Nov/2015:13:50:13 +0000] "GET /js/spice/bitcoin_address/1Biteasym3p5E4soZq8So6NjkjYugEnz2X HTTP/1.1" 200 29 "http://ferr
ari-parker.codio.io:1234/" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/46.0.2490.86 Safari/537.36"       
172.17.42.1 - - [17/Nov/2015:13:50:13 +0000] "GET /share/spice/bitcoin_balance/bitcoin_balance.css HTTP/1.1" 200 1443 "http://ferrari-parker
.codio.io:1234/" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/46.0.2490.86 Safari/537.36"                 
172.17.42.1 - - [17/Nov/2015:13:50:13 +0000] "GET /country.json HTTP/1.1" 200 17 "http://ferrari-parker.codio.io:1234/" "Mozilla/5.0 (X11; L
inux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/46.0.2490.86 Safari/537.36"                                                      
172.17.42.1 - - [17/Nov/2015:13:50:13 +0000] "GET /assets/flags/20/wt.png?v=4 HTTP/1.1" 200 1541 "http://ferrari-parker.codio.io:1234/" "Moz
illa/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/46.0.2490.86 Safari/537.36" 

I think the problem is in ddh10 After some tests I can say you that only ddh1, ddh2 and ddh3 return the api key !

alolis commented 8 years ago

@Mailkov ok, I just checked the biteasy DDG api key and it seems to be valid (with both v1 and v2 API)

moollaza commented 8 years ago

After some tests I can say you that only ddh1, ddh2 and ddh3 return the api key !

Thanks for pointing that out -- looks like some of the ddh machines are a little behind and need to be updated.

They should all have the same API key that we use in production, which I confirmed works, so everything should be OK on that front.

I beleive the problem is with our images endpoint, and I've made a task for the team to investigate what's going on there.

Ok, I suggest to change the documentation https://duck.co/duckduckhack/templates_reference#codebasicimageitemcode-template title is setted as required.

I guess we use the term required loosely. Technically nothing is _required_ to make the templates work. If you pass them no data, they'll render what they can and things will look broken. If you pass them data they don't need, they'll ignore it. If you pass them any of the properties mentioned in the docs, they'll try to use it.

We put required because if you're using that template, you should have a title. We're working on a revised version of the docs right now actually which you can see here: https://talsraviv.gitbooks.io/duckduckhackdocs/content/

moollaza commented 8 years ago

We've fixed this internally :+1: