X embed not working on local instance

Running 5.111 locally on Sequoia trying to embed X post but it gives a 422 console error. It was working with 5.86 a month or so ago. I looked at X embed feature and it seems broken on twitter.publish. Is this a known issue as I couldn’t find anything for this year or last year relevant here. Same for Facebook the ghost docs say it just works but trying to get it to embed FB post too gives similar error. ghost cli 1.27 ghost 5.111 ghost doctor clean bill. Thanks :+1:

Have you checked your Ghost logs to see if there are more details about the failure in the server logs?

1 Like

Thanks will take a look at the logs. So it should work?

Yes, it should work by pasting the Twitter/Facebook post’s URL into the editor.

If both are failing then it’s worth checking your network setup to ensure your Ghost instance is able to make outgoing requests.

Thanks

The twitter embed has just started working again the facebook is giving a 400 error (bad request) this is trying to embed the ghost facebook post at Ghost

[2025-03-12 16:56:24] ERROR “GET /ghost/api/admin/oembed/?url=https%3A%2F%2Fwww.facebook.com%2Fghost%2Fposts%2F660480676191579” 422 213ms

Unable to fetch requested embed.

“Request failed with error code 400”

Error ID:
eec0def0-ff62-11ef-8f71-930d87810d72


ValidationError: Unable to fetch requested embed.
at OEmbedService.knownProvider (/Users/admin/Projects/GhostCMS/versions/5.111.0/core/server/services/oembed/OEmbedService.js:123:19)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async getResponse (/Users/admin/Projects/GhostCMS/versions/5.111.0/node_modules/@tryghost/api-framework/lib/pipeline.js:259:34)
at async ImplWrapper (/Users/admin/Projects/GhostCMS/versions/5.111.0/node_modules/@tryghost/api-framework/lib/pipeline.js:264:30)
at async Http (/Users/admin/Projects/GhostCMS/versions/5.111.0/node_modules/@tryghost/api-framework/lib/http.js:70:28)

But I can use an HTML embed to the same URL and it works so my ghost system can see the endpoint. So I can use FB embed code but the oembed API doesn’t seem to be working I’m wondering if there is more I need to do to get the oembed API to work?

Using HTML to embed bypasses Ghost seeing anything so that doesn’t prove your system can reach the endpoint.

There shouldn’t be anything more you need to do to get the oembed API to work so outside of network related things preventing the Ghost->Facebook request I’m not sure what the issue could be.

I looked at X embed feature and it seems broken on twitter.publish

What do you mean by twitter.publish here?

Thanks, yes its not going through ghost but what I meant was it showed that the URL was valid and public so ghost could embed it.

twitter.publish is what twitter used to embed posts - I think the problem was at the twitter end as it just sprang into life/startedvworking with no changes to ghost.

I was looking at oEmbed - Documentation - Meta for Developers and wondering if a local version of ghost is approved/authorised. I will just have to use the old HTML embed method as a workaround.

I thought meta deprecated their old oembed end point for authorised apps only. I saw another post here that new Facebook embeds would stop working while old ones still work as the code is already in ghost, isn’t that still the case. I will link that post when I find it.

Update that linked article states a non developer account won’t work and you need an API key. I got FB embeds to work manually without a developer account but using the Facebook emded post tool advanced settings and pasting their code into an HTML card. I assume the API does the same thing. I used code injection to reference their JS library required for it to work and I now get adaptive Facebook posts. It definitely sets third party tracking cookies so be aware of that.