Closed shafy closed 1 year ago
Hey there, thank you so much for the detailed bug report.
That does look like something that shouldn't happen! A PR to fix this issue would be very welcome 🙂
Thanks @ErisDS ! I'm not sure I have a lot of spare time in the next weeks, so if anybody else reading this wants to swoop in, feel free! Otherwise, I'll keep it in mind and might get back to it eventually 😇
@ErisDS @shafy Hey, I would like to work on this one
This issue seems to duplicate issue 10624. I traced the problem back to oembed-extractor, which Ghost uses to extract the oembed payload from the provider (in this case Youtube). The extract(url)
function doesn't catch the error and passes the payload directly back to Ghost, which is expecting JSON but instead receives Unauthorized
and gets confused.
Opened issue 168 with oembed-extractor to see if the author can add in some error handling for this case — issue 39 (same issue) was previously closed because the author couldn't replicate the issue, but I've been able to reliably replicate it with the Youtube URL linked above so hopefully should be able to get it resolved this time.
Status update: PR is ready and approved to merge, but we want to be careful with deployment/rollout.
Last time we updated the oembed-parser
package in Pro (~1 year ago), it created a lot of 422 errors. Since we are again trying to upgrade the oembed-parser
package again, we want to carefully deploy this to a subset of Pro users, monitor and if successful, then deploy more widely. As such, we are waiting on the right timing to do this merge so that we have a little time to babysit this rollout.
New error message:
Fixed with this commit: https://github.com/TryGhost/Ghost/commit/27e4523aec3790d2280fbc267d178e145f8b9079
Issue Summary
EDIT: I've figured out that this specific YouTube doesn't allow embedding. Maybe you could improve the error message shown to the user if you get the
Unauthorized
message (see below) so this causes less confusion. I have also updated the issue title to reflect this. I'm leaving the following text here as was to leave the context.In general, YouTube embedding works. But this specific returns an error:
https://www.youtube.com/watch?v=5f-JlzBuUUU
.The request is the following:
The error response is the following:
This is becaue the request
https://www.youtube.com/oembed?format=json&url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3D5f-JlzBuUUU
Returns
Unauthorized
as the response body.Steps to Reproduce
https://www.youtube.com/watch?v=5f-JlzBuUUU
Ghost Version
5.26.3
Node.js Version
16.18.1
How did you install Ghost?
Hetzner, Ubuntu 22.04.1
Database type
MySQL 8
Browser & OS version
No response
Code of Conduct