Could not run server: failed to get json resource on build-in shortcode

Hello, I’m using Hugo 0.48 on Kubuntu 18.04 without internet connection. The Hugo servers could not running, because filed to get json resource.

How to reproduce:

  1. Use the Hugo build-in shortcode: {{< instagram >}} and {{< tweet >}} in contents;
  2. Turn off the WiFi or internet connection;
  3. Run the hugo server.

The erros will be like this and the hugo server could not running.

dian@petanikode:~/blog/petanikode$ hugo server --baseURL "http://localhost"
Building sites … ERROR 2018/09/05 19:33:13 Failed to get json resource https://api.instagram.com/oembed/?url=https://instagram.com/p/BeKcU4DH_d0/&hidecaption=0 with error message Get https://api.instagram.com/oembed/?url=https://instagram.com/p/BeKcU4DH_d0/&hidecaption=0: dial tcp: lookup api.instagram.com on 127.0.0.53:53: server misbehaving
ERROR 2018/09/05 19:33:13 Failed to get json resource https://api.twitter.com/1/statuses/oembed.json?id=51714087842877440&dnt=false with error message Get https://api.twitter.com/1/statuses/oembed.json?id=51714087842877440&dnt=false: dial tcp: lookup api.twitter.com on 127.0.0.53:53: server misbehaving
ERROR 2018/09/05 19:33:13 Failed to get json resource https://api.twitter.com/1/statuses/oembed.json?id=955000830637174784&dnt=false with error message Get https://api.twitter.com/1/statuses/oembed.json?id=955000830637174784&dnt=false: dial tcp: lookup api.twitter.com on 127.0.0.53:53: server misbehaving
ERROR 2018/09/05 19:33:13 error processing shortcode "_internal/shortcodes/instagram.html" for page "post/javascript-fungsi.md": template: _internal/shortcodes/instagram.html:8:8: executing "_internal/shortcodes/instagram.html" at <getJSON "https://api...>: error calling getJSON: Get https://api.instagram.com/oembed/?url=https://instagram.com/p/BeKcU4DH_d0/&hidecaption=0: dial tcp: lookup api.instagram.com on 127.0.0.53:53: server misbehaving    
ERROR 2018/09/05 19:33:13 error processing shortcode "_internal/shortcodes/tweet.html" for page "post/bootstrap4-pemula.md": template: _internal/shortcodes/tweet.html:7:13: executing "_internal/shortcodes/tweet.html" at <getJSON $url>: error calling getJSON: Get https://api.twitter.com/1/statuses/oembed.json?id=955000830637174784&dnt=false: dial tcp: lookup api.twitter.com on 127.0.0.53:53: server misbehaving
ERROR 2018/09/05 19:33:13 Failed to get json resource https://api.twitter.com/1/statuses/oembed.json?id=998095585872830465&dnt=false with error message Get https://api.twitter.com/1/statuses/oembed.json?id=998095585872830465&dnt=false: dial tcp: lookup api.twitter.com on 127.0.0.53:53: server misbehaving
ERROR 2018/09/05 19:33:13 error processing shortcode "_internal/shortcodes/tweet.html" for page "post/hyper.md": template: _internal/shortcodes/tweet.html:7:13: executing "_internal/shortcodes/tweet.html" at <getJSON $url>: error calling getJSON: Get https://api.twitter.com/1/statuses/oembed.json?id=998095585872830465&dnt=false: dial tcp: lookup api.twitter.com on 127.0.0.53:53: server misbehaving
ERROR 2018/09/05 19:33:13 error processing shortcode "_internal/shortcodes/tweet.html" for page "post/skill-programmer.md": template: _internal/shortcodes/tweet.html:7:13: executing "_internal/shortcodes/tweet.html" at <getJSON $url>: error calling getJSON: Get https://api.twitter.com/1/statuses/oembed.json?id=51714087842877440&dnt=false: dial tcp: lookup api.twitter.com on 127.0.0.53:53: server misbehaving
ERROR 2018/09/05 19:33:13 Failed to get json resource https://api.instagram.com/oembed/?url=https://instagram.com/p/BJaTBjwDXQW/&hidecaption=0 with error message Get https://api.instagram.com/oembed/?url=https://instagram.com/p/BJaTBjwDXQW/&hidecaption=0: dial tcp: lookup api.instagram.com on 127.0.0.53:53: server misbehaving
ERROR 2018/09/05 19:33:13 error processing shortcode "_internal/shortcodes/instagram.html" for page "post/skill-programmer.md": template: _internal/shortcodes/instagram.html:8:8: executing "_internal/shortcodes/instagram.html" at <getJSON "https://api...>: error calling getJSON: Get https://api.instagram.com/oembed/?url=https://instagram.com/p/BJaTBjwDXQW/&hidecaption=0: dial tcp: lookup api.instagram.com on 127.0.0.53:53: server misbehaving
ERROR 2018/09/05 19:33:13 Failed to get json resource https://api.twitter.com/1/statuses/oembed.json?id=884544226666569728&dnt=false with error message Get https://api.twitter.com/1/statuses/oembed.json?id=884544226666569728&dnt=false: dial tcp: lookup api.twitter.com on 127.0.0.53:53: server misbehaving
ERROR 2018/09/05 19:33:13 error processing shortcode "_internal/shortcodes/tweet.html" for page "post/slim-api.md": template: _internal/shortcodes/tweet.html:7:13: executing "_internal/shortcodes/tweet.html" at <getJSON $url>: error calling getJSON: Get https://api.twitter.com/1/statuses/oembed.json?id=884544226666569728&dnt=false: dial tcp: lookup api.twitter.com on 127.0.0.53:53: server misbehaving
ERROR 2018/09/05 19:33:13 Failed to get json resource https://api.twitter.com/1/statuses/oembed.json?id=667084553706725377&dnt=false with error message Get https://api.twitter.com/1/statuses/oembed.json?id=667084553706725377&dnt=false: dial tcp: lookup api.twitter.com on 127.0.0.53:53: server misbehaving
ERROR 2018/09/05 19:33:13 error processing shortcode "_internal/shortcodes/tweet.html" for page "post/git-vscode.md": template: _internal/shortcodes/tweet.html:7:13: executing "_internal/shortcodes/tweet.html" at <getJSON $url>: error calling getJSON: Get https://api.twitter.com/1/statuses/oembed.json?id=667084553706725377&dnt=false: dial tcp: lookup api.twitter.com on 127.0.0.53:53: server misbehaving
ERROR 2018/09/05 19:33:13 Failed to get json resource https://api.twitter.com/1/statuses/oembed.json?id=928336059959668736&dnt=false with error message Get https://api.twitter.com/1/statuses/oembed.json?id=928336059959668736&dnt=false: dial tcp: lookup api.twitter.com on 127.0.0.53:53: server misbehaving
ERROR 2018/09/05 19:33:13 error processing shortcode "_internal/shortcodes/tweet.html" for page "post/slim-api.md": template: _internal/shortcodes/tweet.html:7:13: executing "_internal/shortcodes/tweet.html" at <getJSON $url>: error calling getJSON: Get https://api.twitter.com/1/statuses/oembed.json?id=928336059959668736&dnt=false: dial tcp: lookup api.twitter.com on 127.0.0.53:53: server misbehaving
ERROR 2018/09/05 19:33:13 Failed to get json resource https://api.twitter.com/1/statuses/oembed.json?id=904932380133040128&dnt=false with error message Get https://api.twitter.com/1/statuses/oembed.json?id=904932380133040128&dnt=false: dial tcp: lookup api.twitter.com on 127.0.0.53:53: server misbehaving
ERROR 2018/09/05 19:33:13 error processing shortcode "_internal/shortcodes/tweet.html" for page "post/hugo-layout-tema.md": template: _internal/shortcodes/tweet.html:7:13: executing "_internal/shortcodes/tweet.html" at <getJSON $url>: error calling getJSON: Get https://api.twitter.com/1/statuses/oembed.json?id=904932380133040128&dnt=false: dial tcp: lookup api.twitter.com on 127.0.0.53:53: server misbehaving
ERROR 2018/09/05 19:33:13 Failed to get json resource https://api.twitter.com/1/statuses/oembed.json?id=884016383654191104&dnt=false with error message Get https://api.twitter.com/1/statuses/oembed.json?id=884016383654191104&dnt=false: dial tcp: lookup api.twitter.com on 127.0.0.53:53: server misbehaving
ERROR 2018/09/05 19:33:13 error processing shortcode "_internal/shortcodes/tweet.html" for page "post/text-editor-vscode.md": template: _internal/shortcodes/tweet.html:7:13: executing "_internal/shortcodes/tweet.html" at <getJSON $url>: error calling getJSON: Get https://api.twitter.com/1/statuses/oembed.json?id=884016383654191104&dnt=false: dial tcp: lookup api.twitter.com on 127.0.0.53:53: server misbehaving
ERROR 2018/09/05 19:33:13 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.0.53:53: server misbehaving
ERROR 2018/09/05 19:33:13 error processing shortcode "_internal/shortcodes/instagram.html" for page "post/kenapa-menggunakan-linux-untuk-pemrograman.md": template: _internal/shortcodes/instagram.html:8:8: 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.0.53:53: server misbehaving
ERROR 2018/09/05 19:33:13 Failed to get json resource https://api.twitter.com/1/statuses/oembed.json?id=877467306921664513&dnt=false with error message Get https://api.twitter.com/1/statuses/oembed.json?id=877467306921664513&dnt=false: dial tcp: lookup api.twitter.com on 127.0.0.53:53: server misbehaving
ERROR 2018/09/05 19:33:13 error processing shortcode "_internal/shortcodes/tweet.html" for page "post/android-kotlin-extensions.md": template: _internal/shortcodes/tweet.html:7:13: executing "_internal/shortcodes/tweet.html" at <getJSON $url>: error calling getJSON: Get https://api.twitter.com/1/statuses/oembed.json?id=877467306921664513&dnt=false: dial tcp: lookup api.twitter.com on 127.0.0.53:53: server misbehaving
ERROR 2018/09/05 19:33:13 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.0.53:53: server misbehaving
ERROR 2018/09/05 19:33:13 error processing shortcode "_internal/shortcodes/instagram.html" for page "post/belajar-pemrograman-di-bulan-ramadhan.md": template: _internal/shortcodes/instagram.html:8:8: 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.0.53:53: server misbehaving
ERROR 2018/09/05 19:33:13 Failed to get json resource https://api.twitter.com/1/statuses/oembed.json?id=841952471450808321&dnt=false with error message Get https://api.twitter.com/1/statuses/oembed.json?id=841952471450808321&dnt=false: dial tcp: lookup api.twitter.com on 127.0.0.53:53: server misbehaving
ERROR 2018/09/05 19:33:13 error processing shortcode "_internal/shortcodes/tweet.html" for page "post/apa-itu-webassembly.md": template: _internal/shortcodes/tweet.html:7:13: executing "_internal/shortcodes/tweet.html" at <getJSON $url>: error calling getJSON: Get https://api.twitter.com/1/statuses/oembed.json?id=841952471450808321&dnt=false: dial tcp: lookup api.twitter.com on 127.0.0.53:53: server misbehaving
ERROR 2018/09/05 19:33:13 Failed to get json resource https://api.twitter.com/1/statuses/oembed.json?id=824230986774786050&dnt=false with error message Get https://api.twitter.com/1/statuses/oembed.json?id=824230986774786050&dnt=false: dial tcp: lookup api.twitter.com on 127.0.0.53:53: server misbehaving
ERROR 2018/09/05 19:33:13 error processing shortcode "_internal/shortcodes/tweet.html" for page "post/memilih-bahasa-pemrograman.md": template: _internal/shortcodes/tweet.html:7:13: executing "_internal/shortcodes/tweet.html" at <getJSON $url>: error calling getJSON: Get https://api.twitter.com/1/statuses/oembed.json?id=824230986774786050&dnt=false: dial tcp: lookup api.twitter.com on 127.0.0.53:53: server misbehaving
ERROR 2018/09/05 19:33:13 Failed to get json resource https://api.twitter.com/1/statuses/oembed.json?id=824232508422135808&dnt=false with error message Get https://api.twitter.com/1/statuses/oembed.json?id=824232508422135808&dnt=false: dial tcp: lookup api.twitter.com on 127.0.0.53:53: server misbehaving
ERROR 2018/09/05 19:33:13 error processing shortcode "_internal/shortcodes/tweet.html" for page "post/memilih-bahasa-pemrograman.md": template: _internal/shortcodes/tweet.html:7:13: executing "_internal/shortcodes/tweet.html" at <getJSON $url>: error calling getJSON: Get https://api.twitter.com/1/statuses/oembed.json?id=824232508422135808&dnt=false: dial tcp: lookup api.twitter.com on 127.0.0.53:53: server misbehaving
ERROR 2018/09/05 19:33:13 Failed to get json resource https://api.twitter.com/1/statuses/oembed.json?id=824233108853690369&dnt=false with error message Get https://api.twitter.com/1/statuses/oembed.json?id=824233108853690369&dnt=false: dial tcp: lookup api.twitter.com on 127.0.0.53:53: server misbehaving
ERROR 2018/09/05 19:33:13 error processing shortcode "_internal/shortcodes/tweet.html" for page "post/memilih-bahasa-pemrograman.md": template: _internal/shortcodes/tweet.html:7:13: executing "_internal/shortcodes/tweet.html" at <getJSON $url>: error calling getJSON: Get https://api.twitter.com/1/statuses/oembed.json?id=824233108853690369&dnt=false: dial tcp: lookup api.twitter.com on 127.0.0.53:53: server misbehaving
ERROR 2018/09/05 19:33:13 Failed to get json resource https://api.twitter.com/1/statuses/oembed.json?id=824236821861109760&dnt=false with error message Get https://api.twitter.com/1/statuses/oembed.json?id=824236821861109760&dnt=false: dial tcp: lookup api.twitter.com on 127.0.0.53:53: server misbehaving
ERROR 2018/09/05 19:33:13 error processing shortcode "_internal/shortcodes/tweet.html" for page "post/memilih-bahasa-pemrograman.md": template: _internal/shortcodes/tweet.html:7:13: executing "_internal/shortcodes/tweet.html" at <getJSON $url>: error calling getJSON: Get https://api.twitter.com/1/statuses/oembed.json?id=824236821861109760&dnt=false: dial tcp: lookup api.twitter.com on 127.0.0.53:53: server misbehaving
ERROR 2018/09/05 19:33:13 Failed to get json resource https://api.twitter.com/1/statuses/oembed.json?id=836124110597939200&dnt=false with error message Get https://api.twitter.com/1/statuses/oembed.json?id=836124110597939200&dnt=false: dial tcp: lookup api.twitter.com on 127.0.0.53:53: server misbehaving
ERROR 2018/09/05 19:33:13 error processing shortcode "_internal/shortcodes/tweet.html" for page "post/apa-itu-polyglot-programmer.md": template: _internal/shortcodes/tweet.html:7:13: executing "_internal/shortcodes/tweet.html" at <getJSON $url>: error calling getJSON: Get https://api.twitter.com/1/statuses/oembed.json?id=836124110597939200&dnt=false: dial tcp: lookup api.twitter.com on 127.0.0.53:53: server misbehaving
ERROR 2018/09/05 19:33:13 Failed to get json resource https://api.twitter.com/1/statuses/oembed.json?id=835947140383821824&dnt=false with error message Get https://api.twitter.com/1/statuses/oembed.json?id=835947140383821824&dnt=false: dial tcp: lookup api.twitter.com on 127.0.0.53:53: server misbehaving
ERROR 2018/09/05 19:33:13 error processing shortcode "_internal/shortcodes/tweet.html" for page "post/git-branch.md": template: _internal/shortcodes/tweet.html:7:13: executing "_internal/shortcodes/tweet.html" at <getJSON $url>: error calling getJSON: Get https://api.twitter.com/1/statuses/oembed.json?id=835947140383821824&dnt=false: dial tcp: lookup api.twitter.com on 127.0.0.53:53: server misbehaving
ERROR 2018/09/05 19:33:13 Failed to get json resource https://api.twitter.com/1/statuses/oembed.json?id=824237560943677440&dnt=false with error message Get https://api.twitter.com/1/statuses/oembed.json?id=824237560943677440&dnt=false: dial tcp: lookup api.twitter.com on 127.0.0.53:53: server misbehaving
ERROR 2018/09/05 19:33:13 error processing shortcode "_internal/shortcodes/tweet.html" for page "post/memilih-bahasa-pemrograman.md": template: _internal/shortcodes/tweet.html:7:13: executing "_internal/shortcodes/tweet.html" at <getJSON $url>: error calling getJSON: Get https://api.twitter.com/1/statuses/oembed.json?id=824237560943677440&dnt=false: dial tcp: lookup api.twitter.com on 127.0.0.53:53: server misbehaving
ERROR 2018/09/05 19:33:13 Failed to get json resource https://api.twitter.com/1/statuses/oembed.json?id=824240509518430208&dnt=false with error message Get https://api.twitter.com/1/statuses/oembed.json?id=824240509518430208&dnt=false: dial tcp: lookup api.twitter.com on 127.0.0.53:53: server misbehaving
ERROR 2018/09/05 19:33:13 error processing shortcode "_internal/shortcodes/tweet.html" for page "post/memilih-bahasa-pemrograman.md": template: _internal/shortcodes/tweet.html:7:13: executing "_internal/shortcodes/tweet.html" at <getJSON $url>: error calling getJSON: Get https://api.twitter.com/1/statuses/oembed.json?id=824240509518430208&dnt=false: dial tcp: lookup api.twitter.com on 127.0.0.53:53: server misbehaving
ERROR 2018/09/05 19:33:13 Failed to get json resource https://api.twitter.com/1/statuses/oembed.json?id=824242367926444038&dnt=false with error message Get https://api.twitter.com/1/statuses/oembed.json?id=824242367926444038&dnt=false: dial tcp: lookup api.twitter.com on 127.0.0.53:53: server misbehaving
ERROR 2018/09/05 19:33:13 error processing shortcode "_internal/shortcodes/tweet.html" for page "post/memilih-bahasa-pemrograman.md": template: _internal/shortcodes/tweet.html:7:13: executing "_internal/shortcodes/tweet.html" at <getJSON $url>: error calling getJSON: Get https://api.twitter.com/1/statuses/oembed.json?id=824242367926444038&dnt=false: dial tcp: lookup api.twitter.com on 127.0.0.53:53: server misbehaving
ERROR 2018/09/05 19:33:13 Failed to get json resource https://api.twitter.com/1/statuses/oembed.json?id=836124110597939200&dnt=false with error message Get https://api.twitter.com/1/statuses/oembed.json?id=836124110597939200&dnt=false: dial tcp: lookup api.twitter.com on 127.0.0.53:53: server misbehaving
ERROR 2018/09/05 19:33:13 error processing shortcode "_internal/shortcodes/tweet.html" for page "post/memilih-bahasa-pemrograman.md": template: _internal/shortcodes/tweet.html:7:13: executing "_internal/shortcodes/tweet.html" at <getJSON $url>: error calling getJSON: Get https://api.twitter.com/1/statuses/oembed.json?id=836124110597939200&dnt=false: dial tcp: lookup api.twitter.com on 127.0.0.53:53: server misbehaving
ERROR 2018/09/05 19:33:13 Failed to get json resource https://api.twitter.com/1/statuses/oembed.json?id=829743602175610881&dnt=false with error message Get https://api.twitter.com/1/statuses/oembed.json?id=829743602175610881&dnt=false: dial tcp: lookup api.twitter.com on 127.0.0.53:53: server misbehaving
ERROR 2018/09/05 19:33:13 error processing shortcode "_internal/shortcodes/tweet.html" for page "post/git-untuk-pemula.md": template: _internal/shortcodes/tweet.html:7:13: executing "_internal/shortcodes/tweet.html" at <getJSON $url>: error calling getJSON: Get https://api.twitter.com/1/statuses/oembed.json?id=829743602175610881&dnt=false: dial tcp: lookup api.twitter.com on 127.0.0.53:53: server misbehaving
ERROR 2018/09/05 19:33:13 Failed to get json resource https://api.twitter.com/1/statuses/oembed.json?id=828231245591048198&dnt=false with error message Get https://api.twitter.com/1/statuses/oembed.json?id=828231245591048198&dnt=false: dial tcp: lookup api.twitter.com on 127.0.0.53:53: server misbehaving
ERROR 2018/09/05 19:33:13 error processing shortcode "_internal/shortcodes/tweet.html" for page "post/vuejs-berkenalan.md": template: _internal/shortcodes/tweet.html:7:13: executing "_internal/shortcodes/tweet.html" at <getJSON $url>: error calling getJSON: Get https://api.twitter.com/1/statuses/oembed.json?id=828231245591048198&dnt=false: dial tcp: lookup api.twitter.com on 127.0.0.53:53: server misbehaving
ERROR 2018/09/05 19:33:13 Failed to get json resource https://api.twitter.com/1/statuses/oembed.json?id=821021406854946816&dnt=false with error message Get https://api.twitter.com/1/statuses/oembed.json?id=821021406854946816&dnt=false: dial tcp: lookup api.twitter.com on 127.0.0.53:53: server misbehaving
ERROR 2018/09/05 19:33:13 error processing shortcode "_internal/shortcodes/tweet.html" for page "post/migrasi-blogger-ke-hugo.md": template: _internal/shortcodes/tweet.html:7:13: executing "_internal/shortcodes/tweet.html" at <getJSON $url>: error calling getJSON: Get https://api.twitter.com/1/statuses/oembed.json?id=821021406854946816&dnt=false: dial tcp: lookup api.twitter.com on 127.0.0.53:53: server misbehaving
ERROR 2018/09/05 19:33:13 Failed to get json resource https://api.instagram.com/oembed/?url=https://instagram.com/p/BJaTBjwDXQW/&hidecaption=0 with error message Get https://api.instagram.com/oembed/?url=https://instagram.com/p/BJaTBjwDXQW/&hidecaption=0: dial tcp: lookup api.instagram.com on 127.0.0.53:53: server misbehaving
ERROR 2018/09/05 19:33:13 error processing shortcode "_internal/shortcodes/instagram.html" for page "post/resolusi-coding-2017.md": template: _internal/shortcodes/instagram.html:8:8: executing "_internal/shortcodes/instagram.html" at <getJSON "https://api...>: error calling getJSON: Get https://api.instagram.com/oembed/?url=https://instagram.com/p/BJaTBjwDXQW/&hidecaption=0: dial tcp: lookup api.instagram.com on 127.0.0.53:53: server misbehaving
ERROR 2018/09/05 19:33:13 Failed to get json resource https://api.instagram.com/oembed/?url=https://instagram.com/p/BJ5KW3EDw7Q/&hidecaption=0 with error message Get https://api.instagram.com/oembed/?url=https://instagram.com/p/BJ5KW3EDw7Q/&hidecaption=0: dial tcp: lookup api.instagram.com on 127.0.0.53:53: server misbehaving
ERROR 2018/09/05 19:33:13 error processing shortcode "_internal/shortcodes/instagram.html" for page "post/php-dir.md": template: _internal/shortcodes/instagram.html:8:8: executing "_internal/shortcodes/instagram.html" at <getJSON "https://api...>: error calling getJSON: Get https://api.instagram.com/oembed/?url=https://instagram.com/p/BJ5KW3EDw7Q/&hidecaption=0: dial tcp: lookup api.instagram.com on 127.0.0.53:53: server misbehaving
ERROR 2018/09/05 19:33:13 Failed to get json resource https://api.instagram.com/oembed/?url=https://instagram.com/p/BJpb-wNjGAo/&hidecaption=0 with error message Get https://api.instagram.com/oembed/?url=https://instagram.com/p/BJpb-wNjGAo/&hidecaption=0: dial tcp: lookup api.instagram.com on 127.0.0.53:53: server misbehaving
ERROR 2018/09/05 19:33:13 error processing shortcode "_internal/shortcodes/instagram.html" for page "post/python-json.md": template: _internal/shortcodes/instagram.html:8:8: executing "_internal/shortcodes/instagram.html" at <getJSON "https://api...>: error calling getJSON: Get https://api.instagram.com/oembed/?url=https://instagram.com/p/BJpb-wNjGAo/&hidecaption=0: dial tcp: lookup api.instagram.com on 127.0.0.53:53: server misbehaving
ERROR 2018/09/05 19:33:13 Failed to get json resource https://api.twitter.com/1/statuses/oembed.json?id=818038227143561218&dnt=false with error message Get https://api.twitter.com/1/statuses/oembed.json?id=818038227143561218&dnt=false: dial tcp: lookup api.twitter.com on 127.0.0.53:53: server misbehaving
ERROR 2018/09/05 19:33:13 error processing shortcode "_internal/shortcodes/tweet.html" for page "post/inspect-element.md": template: _internal/shortcodes/tweet.html:7:13: executing "_internal/shortcodes/tweet.html" at <getJSON $url>: error calling getJSON: Get https://api.twitter.com/1/statuses/oembed.json?id=818038227143561218&dnt=false: dial tcp: lookup api.twitter.com on 127.0.0.53:53: server misbehaving
ERROR 2018/09/05 19:33:13 Failed to get json resource https://api.twitter.com/1/statuses/oembed.json?id=852692611932372992&dnt=false with error message Get https://api.twitter.com/1/statuses/oembed.json?id=852692611932372992&dnt=false: dial tcp: lookup api.twitter.com on 127.0.0.53:53: server misbehaving
ERROR 2018/09/05 19:33:13 error processing shortcode "_internal/shortcodes/tweet.html" for page "post/java-perulangan.md": template: _internal/shortcodes/tweet.html:7:13: executing "_internal/shortcodes/tweet.html" at <getJSON $url>: error calling getJSON: Get https://api.twitter.com/1/statuses/oembed.json?id=852692611932372992&dnt=false: dial tcp: lookup api.twitter.com on 127.0.0.53:53: server misbehaving
ERROR 2018/09/05 19:33:13 Failed to get json resource https://api.twitter.com/1/statuses/oembed.json?id=943284329836187649&dnt=false with error message Get https://api.twitter.com/1/statuses/oembed.json?id=943284329836187649&dnt=false: dial tcp: lookup api.twitter.com on 127.0.0.53:53: server misbehaving
ERROR 2018/09/05 19:33:13 error processing shortcode "_internal/shortcodes/tweet.html" for page "post/php-perulangan.md": template: _internal/shortcodes/tweet.html:7:13: executing "_internal/shortcodes/tweet.html" at <getJSON $url>: error calling getJSON: Get https://api.twitter.com/1/statuses/oembed.json?id=943284329836187649&dnt=false: dial tcp: lookup api.twitter.com on 127.0.0.53:53: server misbehaving
ERROR 2018/09/05 19:33:13 Failed to get json resource https://api.instagram.com/oembed/?url=https://instagram.com/p/BJehYJRj8x-/&hidecaption=0 with error message Get https://api.instagram.com/oembed/?url=https://instagram.com/p/BJehYJRj8x-/&hidecaption=0: dial tcp: lookup api.instagram.com on 127.0.0.53:53: server misbehaving
ERROR 2018/09/05 19:33:13 error processing shortcode "_internal/shortcodes/instagram.html" for page "post/java-variabel-dan-tipe-data.md": template: _internal/shortcodes/instagram.html:8:8: executing "_internal/shortcodes/instagram.html" at <getJSON "https://api...>: error calling getJSON: Get https://api.instagram.com/oembed/?url=https://instagram.com/p/BJehYJRj8x-/&hidecaption=0: dial tcp: lookup api.instagram.com on 127.0.0.53:53: server misbehaving
ERROR 2018/09/05 19:33:13 Failed to get json resource https://api.twitter.com/1/statuses/oembed.json?id=884544226666569728&dnt=false with error message Get https://api.twitter.com/1/statuses/oembed.json?id=884544226666569728&dnt=false: dial tcp: lookup api.twitter.com on 127.0.0.53:53: server misbehaving
ERROR 2018/09/05 19:33:13 error processing shortcode "_internal/shortcodes/tweet.html" for page "post/slim-untuk-pemula.md": template: _internal/shortcodes/tweet.html:7:13: executing "_internal/shortcodes/tweet.html" at <getJSON $url>: error calling getJSON: Get https://api.twitter.com/1/statuses/oembed.json?id=884544226666569728&dnt=false: dial tcp: lookup api.twitter.com on 127.0.0.53:53: server misbehaving
Total in 8827 ms
Error: Error building site: logged 35 error(s)

What should I do?

There was some discussion in the past about turning these build preventing errors into warnings but it wasn’t implemented.

This is the caveat when working with online data.

The only options I can think of are:

  1. Remove the relevant content files when working locally without internet connection.

OR

  1. Download the JSON files when online, save them into /data/ and then refactor the Instagram and Tweet shortcodes to use the local files.

Both less than ideal but there isn’t much else you could do I’m afraid.

Unless someone else has another workaround, that I am not aware of.

The issue I found was closed so this is simply a limitation (if we should call it that, more like a feature perhaps).

So Ardianta the points that Onedrawingperday list here are the best options available. :slight_smile:

Solved.

Here the solution:

Override the build-in shortcodes. Use the .Site.IsServer variable to check, if it running/rendering on Hugo server.

Create new shortcode called tweet.html and instagram.html to override the build-in shortcodes.

Here my tweet.html shortcode:

{{ if not .Site.IsServer }}
    {{ template "_internal/shortcodes/twitter.html" . }}
{{ else }}
    <!-- Render the placeholder for the shortcode -->
    <pre>Twitter embed: {{ .Get 0 }}</pre>
{{ end }}

and here my instagram shorcode:

{{ if not .Site.IsServer }}
    {{ template "_internal/shortcodes/instagram.html" . }}
{{ else }}
    <!-- Render the placeholder for the shortcode -->
    <pre>Instagram Photo: {{ .Get 0 }}</pre>
{{ end }}

I think we should add the “Shortcode Overriding” section on Hugo documentations.

4 Likes

South Africa has severe power issues and though I have a battery back-up, I live in a rural area where the infrastructure delivering Internet, dies during power cuts. This can be four hours of a typical working day. Obviously, when the Internet is down, I cannot invoke hugo server to test sites since I use shortcodes everywhere.

I can use the .Site.IsServer workaround here. But it might be an option to consider whether a parameter to hugo server might not be the preferable solution such as:

  • Hugo server can be forced to serve pages regardless of errors
  • Hugo server can be forced to turn the rendering of shortcodes off
  • Or simply include the .Site.IsServer code in the internal shortcodes inside Hugo - the simplest option.

This might also be useful to developers in general when shortcodes are developed/debugged.

Thank you very much! This is exactly what I needed. For some reason for weeks my Instagram shortcodes worked just fine, then last week I had this problem with a new page, and today a page with 9 of them all failed, though from my web browser the JSON links all work. Anyway, thank you very much for a solution that solved my problem quickly and helps me understand Hugo better.