Instagram Embeds Broke My Hugo Build After the oEmbed API Shutdown

Failed to retrieve remote file: Bad Request

* This page contains promotional content

Recently, after fixing Hugo settings or creating and editing articles, the build started failing and I could no longer update the site.

Symptoms

Failed to get JSON resource “https://api.instagram.com/oembed/?url=https://www.instagram.com/p/BGvuInxxxx/&maxwidth=640&omitscript=true" : Failed to retrieve remote file: Bad Request

Looking at the deploy log, Failed was displayed at the Instagram API part and the build was being aborted.

It seems that in Hugo, when an instagram shortcode is inserted, the build now fails.

Cause

The Instagram API can no longer be used as it is; it cannot be used unless it is configured with a Facebook developer account.

Note: Facebook and Instagram support is out of scope in this proposal since they require a Facebook Developer Account.
Basically Facebook has ended free access to the Instagram API. This affects both the regular and simple Instagram shortcodes.

The solution

If you want to keep using Instagram embeds, it seems the only option is to set things up from a Facebook developer account. (The shortcode or the embed code inside the article may need work too?)

Incidentally, in my environment Instagram embeds were as good as nonexistent, so I deleted them from the articles that used them.

Commenting out the Instagram shortcode part seems to be acceptable as well, but deleting it causes less trouble and feels tidier.