This error produced because I use build-in short codes and run the server at offline and low speed internet connection.
I use Hugo 0.26.
$ hugo server
Started building sites ...
ERROR 2017/09/08 20:16:40 Failed to get json resource https://api.instagram.com/oembed/?url=https://instagram.com/p/BO7MM-bFJti/&hidecaption=0 with error message Get https://api.instagram.com/oembed/?url=https://instagram.com/p/BO7MM-bFJti/&hidecaption=0: dial tcp: lookup api.instagram.com on 127.0.1.1:53: read udp 127.0.0.1:56539->127.0.1.1:53: i/o timeout
ERROR 2017/09/08 20:16:40 Failed to get json resource https://api.instagram.com/oembed/?url=https://instagram.com/p/BSzsm6Gg7oE/&hidecaption=0 with error message Get https://api.instagram.com/oembed/?url=https://instagram.com/p/BSzsm6Gg7oE/&hidecaption=0: dial tcp: lookup api.instagram.com on 127.0.1.1:53: read udp 127.0.0.1:56539->127.0.1.1:53: i/o timeout
ERROR 2017/09/08 20:16:40 error processing shortcode "_internal/shortcodes/instagram.html" for page "artikel/belajar-pemrograman-di-bulan-ramadhan.md": template: _internal/shortcodes/instagram.html:1:238: executing "_internal/shortcodes/instagram.html" at <getJSON "https://api...>: error calling getJSON: Get https://api.instagram.com/oembed/?url=https://instagram.com/p/BO7MM-bFJti/&hidecaption=0: dial tcp: lookup api.instagram.com on 127.0.1.1:53: read udp 127.0.0.1:56539->127.0.1.1:53: i/o timeout
ERROR 2017/09/08 20:16:40 error processing shortcode "_internal/shortcodes/instagram.html" for page "artikel/kenapa-menggunakan-linux-untuk-pemrograman.md": template: _internal/shortcodes/instagram.html:1:238: executing "_internal/shortcodes/instagram.html" at <getJSON "https://api...>: error calling getJSON: Get https://api.instagram.com/oembed/?url=https://instagram.com/p/BSzsm6Gg7oE/&hidecaption=0: dial tcp: lookup api.instagram.com on 127.0.1.1:53: read udp 127.0.0.1:56539->127.0.1.1:53: i/o timeout
ERROR 2017/09/08 20:17:00 Failed to get json resource https://api.twitter.com/1/statuses/oembed.json?id=904932380133040128 with error message Get https://api.twitter.com/1/statuses/oembed.json?id=904932380133040128: dial tcp 104.244.42.2:443: i/o timeout
ERROR 2017/09/08 20:17:00 error processing shortcode "_internal/shortcodes/tweet.html" for page "artikel/hugo-layout-tema.md": template: _internal/shortcodes/tweet.html:1:4: executing "_internal/shortcodes/tweet.html" at <getJSON "https://api...>: error calling getJSON: Get https://api.twitter.com/1/statuses/oembed.json?id=904932380133040128: dial tcp 104.244.42.2:443: i/o timeout
ERROR 2017/09/08 20:17:00 Failed to get json resource https://api.twitter.com/1/statuses/oembed.json?id=877467306921664513 with error message Get https://api.twitter.com/1/statuses/oembed.json?id=877467306921664513: dial tcp 104.244.42.2:443: i/o timeout
ERROR 2017/09/08 20:17:00 error processing shortcode "_internal/shortcodes/tweet.html" for page "artikel/android-kotlin-extensions.md": template: _internal/shortcodes/tweet.html:1:4: executing "_internal/shortcodes/tweet.html" at <getJSON "https://api...>: error calling getJSON: Get https://api.twitter.com/1/statuses/oembed.json?id=877467306921664513: dial tcp 104.244.42.2:443: i/o timeout
ERROR 2017/09/08 20:17:10 Failed to get json resource https://api.twitter.com/1/statuses/oembed.json?id=841952471450808321 with error message Get https://api.twitter.com/1/statuses/oembed.json?id=841952471450808321: dial tcp 104.244.42.194:443: i/o timeout
ERROR 2017/09/08 20:17:10 error processing shortcode "_internal/shortcodes/tweet.html" for page "artikel/apa-itu-webassembly.md": template: _internal/shortcodes/tweet.html:1:4: executing "_internal/shortcodes/tweet.html" at <getJSON "https://api...>: error calling getJSON: Get https://api.twitter.com/1/statuses/oembed.json?id=841952471450808321: dial tcp 104.244.42.194:443: i/o timeout
ERROR 2017/09/08 20:17:10 Failed to get json resource https://api.twitter.com/1/statuses/oembed.json?id=835947140383821824 with error message Get https://api.twitter.com/1/statuses/oembed.json?id=835947140383821824: dial tcp 104.244.42.194:443: i/o timeout
ERROR 2017/09/08 20:17:10 error processing shortcode "_internal/shortcodes/tweet.html" for page "artikel/git-branch.md": template: _internal/shortcodes/tweet.html:1:4: executing "_internal/shortcodes/tweet.html" at <getJSON "https://api...>: error calling getJSON: Get https://api.twitter.com/1/statuses/oembed.json?id=835947140383821824: dial tcp 104.244.42.194:443: i/o timeout
Built site for language id:
0 of 136 drafts rendered
0 future content
0 expired content
230 regular pages created
358 other pages created
0 non-page files copied
346 paginator pages created
149 topik created
11 kategori created
14 seri created
total in 40887 ms
Watching for changes in /home/petanikode/petanikode-hugo/{data,content,layouts,static,themes}
Serving pages from memory
Web Server is available at http://localhost:1313/ (bind address 127.0.0.1)
Press Ctrl+C to stop
Its take long time to build and run the server. Because the Instagram and tweet short code trying to getJSON from API first.
I think it would better if that short code available for offline build.
I think it would better if that short code available for offline build.
Not sure what you suggest. We do cache the result once it is retrieved, but it is a remote service, so it is not possible to make it entirely offline.
I'm a Chinese developer and got the same issue.
That's not the "same issue". You got a timeout there. Start looking into cache.
I use this https://github.com/gohugoio/hugoBasicExample to develop the theme, and the shortcodes are Twiter Vimeo ... But China has banned visits to Twitter, so I got the error. I tried setting "timeout" to 30s and setting the proxy but not work.
Hi @nanxiaobei, I solved this problem by creating new shotcodes for twitter and instagram.
This is my shortcode for Twitter: layouts/shortcodes/twitter.html
{{ if not .Site.IsServer }}
{{ template "_internal/shortcodes/twitter.html" . }}
{{ else }}
<!-- Render the placeholder for the shortcode -->
<pre>Twitter embed: {{ .Get 0 }}</pre>
{{ end }}
and this for Instagram: layouts/shortcodes/instagram.html
{{ if not .Site.IsServer }}
{{ template "_internal/shortcodes/instagram.html" . }}
{{ else }}
<!-- Render the placeholder for the shortcode -->
<pre>Instagram Photo: {{ .Get 0 }}</pre>
{{ end }}
So, whenever you run the local server, the build-in shortcodes will not be used.
@ardianta
Thanks a lot, I'll try it!
Most helpful comment
Hi @nanxiaobei, I solved this problem by creating new shotcodes for twitter and instagram.
This is my shortcode for Twitter:
layouts/shortcodes/twitter.htmland this for Instagram:
layouts/shortcodes/instagram.htmlSo, whenever you run the local server, the build-in shortcodes will not be used.