TryGhost / Ghost

Independent technology for modern publishing, memberships, subscriptions and newsletters.
https://ghost.org
MIT License
47.4k stars 10.34k forks source link

Appending storage bucket ID to beginning of URL when fetching favicon #11436

Closed devinowen closed 4 years ago

devinowen commented 4 years ago

Issue Summary

Loading a favicon.png file from custom storage adapter on article pages throws a 500. It looks like the location URL has the original bucket ID string appended to the beginning, so that it's trying to get the icon from a URL like this:

BUCKET_ID/https://BUCKET_ID.storage.googleapis.com/2019/11/logo.png

Instead of what it should be:

https://BUCKET_ID.storage.googleapis.com/2019/11/logo.png

@mikenikles looked into it on the adapter side, and found that the URL was being stored correctly in the DB. However, somewhere in the retrieval process (perhaps in getLocalFileStoragePath()?) the bucket ID is incorrectly appended. 👇 https://github.com/mikenikles/ghost-v3-google-cloud-storage/issues/1#issuecomment-560022344

To note, retrieval of all other assets work correctly using the custom adapter's read() method.

To Reproduce

  1. Create a new Ghost blog and add the https://github.com/mikenikles/ghost-v3-google-cloud-storage/blob/master/src/index.js adapter.
  2. Upload a favicon image. Upload works fine, but retrieval throws a 500. This doesn't occur for other assets.

Technical details:

Thanks all!

johngoggs commented 4 years ago

+1

I also have this issue, and I've had it since 2.3x.x. I thought it was to do with an old GCS Storage Adapter, so I never reported it. The only difference I have to @devinowen, I have a CDN set up, so I have the CDN variable set.

When I was using GCS on 2.3x.x, with the adapter from KaySchneider, I had the CDN (assetDomain) variable set. I was also running Ghost in App Engine at this time, a different platform to what I am running now.

I have used a fresh 3.1.1 install, in Cloud run and against a clean Cloud SQL database, and I still get the same issue. I've tried the new install on Node 10.13 and 12.13.1.

Symptom: Ghost can take up to 30 seconds to load because of this.

Technical details:

Ghost Version: 3.1.1 Node Version: >10.0.0 Browser/OS: Chrome 78/ Windows 10 1903 Database: Google Cloud Platform MySQL

stale[bot] commented 4 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

devinowen commented 4 years ago

Any thoughts on if this is addressable in the Ghost codebase itself, or is in in the adapter? Seems like the issue may be in getLocalFileStoragePath()?

stale[bot] commented 4 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

safaci2000 commented 3 years ago

Is it possible to re-open this ticket? Or would you like me to open a new one? I'm running into the same issue with ghost 3.41 and danmasta/ghost-gcs-adapter@0.0.3. I'm running it in docker if it matters.

InternalServerError: Ghost GCS Adapter Error: No such object: gb-www-geekbeacon/https:/storage.googleapis.com/gb-www-geekbeacon/2021/03/0090a2b1dfbfdaf5.png