Unable to find storage adapter in original path

I use ghost-CLI to update ghost from 3.17.1 to 3.25.0. But when I “ghost start”, some errors come up:

Debug Information:
    OS: CentOS Linux, v7
    Node Version: v12.18.2
    Ghost Version: 3.25.0
    Ghost-CLI Version: 1.14.1
    Environment: production
    Command: 'ghost start'
Message: Unable to find storage adapter qn-store in ,/var/www/ghost/content/adapters/,/var/www/ghost/versions/3.25.0/core/server/adapters/.
Suggestion: journalctl -u ghost_halfrost-com -n 50
Stack: Error: Unable to find storage adapter qn-store in ,/var/www/ghost/content/adapters/,/var/www/ghost/versions/3.25.0/core/server/adapters/ | /var/www/ghost/versions/3.25.0/core/server/adapters/storage/qn-store | /var/www/ghost/versions/3.25.0/core/server/adapters/.
    at Server.<anonymous> (/root/.nvm/versions/node/v12.18.2/lib/node_modules/ghost-cli/lib/utils/port-polling.js:38:28)
    at Object.onceWrapper (events.js:421:28)
    at Server.emit (events.js:315:20)
    at emitCloseNT (net.js:1655:8)
    at processTicksAndRejections (internal/process/task_queues.js:83:21)

my config.production.json :

  "storage": {
    "active": "qn-store",
    "qn-store": {
      "accessKey": "XXXXXX",
      "secretKey": "XXXXX",
      "bucket": "XXXX",
      "origin": "https://XXXXX.com",
      "fileKey": {
        "safeString": true,
        "prefix": "[Blog/XXXX/]",
        "suffix": "",
        "extname": true
      }
    }
  }

qn-store has been in /var/www/ghost/content/adapters/qn-store and /var/www/ghost/versions/3.25.0/core/server/adapters/qn-store. I use this module for 3 years without any error.

(qn-store is a storage module, ref: GitHub - minwe/qn-store: Ghost Qiniu storage module.)

I diff 3.17.1 and 3.25.0, only one commit change storage path, #11850. But I don’t sure this commit causes the bug.

I debug some code, but I haven’t find the root cause.

for (const pathToAdapters of this.pathsToAdapters) {
            const pathToAdapter = path.join(pathToAdapters, adapterType, adapterName);
            try {
                Adapter = this.loadAdapterFromPath(pathToAdapter);
                if (Adapter) {
                    break;
               }
            } catch (err) {
                // Catch runtime errors
                if (err.code !== 'MODULE_NOT_FOUND') {
                    throw new errors.IncorrectUsageError({err});
                }

                // Catch missing dependencies BUT NOT missing adapter
                if (!err.message.includes(pathToAdapter)) {
                    throw new errors.IncorrectUsageError({
                        message: `You are missing dependencies in your adapter ${pathToAdapter}`,
                        err
                    });
                }
            }
        }

        if (!Adapter) {
            throw new errors.IncorrectUsageError({
                message: `Unable to find ${adapterType} adapter ${adapterName} in ${this.pathsToAdapters}.`
            });
        }

According to the error message, we can found this Adapter is null. pathToAdapter is ‘/var/www/ghost/versions/3.25.0/core/server/adapters/storage/qn-store’, pathToAdapters is /var/www/ghost/versions/3.25.0/core/server/adapters/. These logic is all correct. But I still don’t know why Adapter is null.

I check two paths (/var/www/ghost/versions/3.25.0/core/server/adapters/storage/qn-store & /var/www/ghost/content/adapters/storage/qn-store) again and again. I don’t find anything wrong.

Could you help me? Maybe you can find the problem soon.

This is due to issues with the adapter - not with Ghost. The adapter is making use of internal APIs in Ghost which are subject to change.

1 Like

Could you tell me what internal APIs have changed about the adapter recently?

Could you tell me what internal APIs have changed about the adapter recently?

@halfrost I have meet the same problem with you.

qn-store not support v3.x and the author no longer maintain this project

So I fork the project and rewrite some code, it can run in v3.x

@jerry.mei Thanks, I also modify its code. My ghost blog runs well now.