Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ghost fails with error when r2 adapter is integrated #1

Open
bonysimon007 opened this issue Apr 19, 2023 · 2 comments
Open

Ghost fails with error when r2 adapter is integrated #1

bonysimon007 opened this issue Apr 19, 2023 · 2 comments

Comments

@bonysimon007
Copy link

I tried using the adapter but it failed with the below error. I never worked on TS hence was not able to debug and fix it.
My deployment environment is as follows.
OS: ubuntu 22.04
Ghost : Latest Ghost with docker
Cloudflare already configured

[2023-04-19 00:36:33] INFO Ghost is running in production...
[2023-04-19 00:36:33] INFO Your site is now available on https://sitename.tld/
[2023-04-19 00:36:33] INFO Ctrl+C to shut down
[2023-04-19 00:36:33] INFO Ghost server started in 1.285s
[2023-04-19 00:36:33] INFO Database is in a ready state.
[2023-04-19 00:36:34] INFO Ghost database ready in 1.677s
[2023-04-19 00:36:37] ERROR We detected a misuse. Please read the stack trace.

We detected a misuse. Please read the stack trace.

Error ID:
3e7c67c0-de4a-11ed-9324-3587dc794858


Error:
at AdapterManager.getAdapter (/var/lib/ghost/versions/5.43.0/node_modules/@tryghost/adapter-manager/lib/AdapterManager.js:114:27)
Something went wrong installing the "sharp" module

Cannot find module '../build/Release/sharp-linux-x64.node'
Require stack:

  • /var/lib/ghost/content/adapters/storage/ghost-cloudflare-r2/node_modules/sharp/lib/sharp.js
  • /var/lib/ghost/content/adapters/storage/ghost-cloudflare-r2/node_modules/sharp/lib/constructor.js
  • /var/lib/ghost/content/adapters/storage/ghost-cloudflare-r2/node_modules/sharp/lib/index.js
  • /var/lib/ghost/content/adapters/storage/ghost-cloudflare-r2/index.js
  • /var/lib/ghost/versions/5.43.0/core/server/services/adapter-manager/index.js
  • /var/lib/ghost/versions/5.43.0/core/server/adapters/storage/index.js
  • /var/lib/ghost/versions/5.43.0/core/server/lib/image/index.js
  • /var/lib/ghost/versions/5.43.0/core/server/models/member.js
  • /var/lib/ghost/versions/5.43.0/core/server/models/index.js
  • /var/lib/ghost/versions/5.43.0/core/server/services/url/Resources.js
  • /var/lib/ghost/versions/5.43.0/core/server/services/url/UrlService.js
  • /var/lib/ghost/versions/5.43.0/core/server/services/url/index.js
  • /var/lib/ghost/versions/5.43.0/core/app.js
  • /var/lib/ghost/versions/5.43.0/core/boot.js
  • /var/lib/ghost/versions/5.43.0/ghost.js
  • /var/lib/ghost/versions/5.43.0/index.js

Possible solutions:

  • Install with verbose logging and look for errors: "npm install --ignore-scripts=false --foreground-scripts --verbose sharp"
  • Install for the current linux-x64 runtime: "npm install --platform=linux --arch=x64 sharp"
  • Consult the installation documentation: https://sharp.pixelplumbing.com/install
    at Object. (/var/lib/ghost/content/adapters/storage/ghost-cloudflare-r2/node_modules/sharp/lib/sharp.js:34:9)
    at Module._compile (node:internal/modules/cjs/loader:1196:14)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1250:10)
    at Module.load (node:internal/modules/cjs/loader:1074:32)
    at Function.Module._load (node:internal/modules/cjs/loader:909:12)
    at Module.require (node:internal/modules/cjs/loader:1098:19)
    at require (node:internal/modules/cjs/helpers:108:18)
    at Object. (/var/lib/ghost/content/adapters/storage/ghost-cloudflare-r2/node_modules/sharp/lib/constructor.js:8:1)
    at Module._compile (node:internal/modules/cjs/loader:1196:14)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1250:10)
    at Module.load (node:internal/modules/cjs/loader:1074:32)
    at Function.Module._load (node:internal/modules/cjs/loader:909:12)
    at Module.require (node:internal/modules/cjs/loader:1098:19)
    at require (node:internal/modules/cjs/helpers:108:18)
    at Object. (/var/lib/ghost/content/adapters/storage/ghost-cloudflare-r2/node_modules/sharp/lib/index.js:3:15)
    at Module._compile (node:internal/modules/cjs/loader:1196:14)

Thanks in advance

@egeldenhuys
Copy link
Owner

Hi @bonysimon007 , thank you for the feedback!

There seems to be some issue with the 'sharp' package not being installed.

What steps did you follow to install the plugin?

I will try to replicate the issue, maybe I missed something in the documentation.

@bonysimon007
Copy link
Author

bonysimon007 commented Apr 19, 2023

Hello @egeldenhuys
Thanks for the quick response. Below is how I did it.
Inside the volume mount directory of docker ghost below commands were executed

`
mkdir -p content/adapters/storage

cd content/adapters/storage

git clone https://github.com/egeldenhuys/ghost-cloudflare-r2

cd ghost-cloudflare-r2

git checkout v0.1.0

./build-in-docker.sh

`

Finally docker compose up -d

The configurations were added inside docker-compose.yml

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants