Search code examples
parse-platformamazon-elastic-beanstalkparse-server

How to deploy a commit of parse server?


How do I deploy a specific commit of parse server on AWS EB?

I tried to:

  1. Change the package.json of parse-server-example to:

    "dependencies": { "parse-server": "parse-community/parse-server#commit-hash" }

  2. Run npm install

  3. Deploy to AWS EB

The server fails to start with error:

Error: Cannot find module '/var/app/current/node_modules/parse-server/lib/index.js'. Please verify that the package.json has a valid "main" entry
    at tryPackage (internal/modules/cjs/loader.js:316:19)
    at Function.Module._findPath (internal/modules/cjs/loader.js:705:18)
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:969:27)
    at Function.Module._load (internal/modules/cjs/loader.js:864:27)
    at Module.require (internal/modules/cjs/loader.js:1044:19)
    at require (internal/modules/cjs/helpers.js:77:18)
    at Object.<anonymous> (/var/app/current/index.js:10:19)
    at Module._compile (internal/modules/cjs/loader.js:1158:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1178:10)
    at Module.load (internal/modules/cjs/loader.js:1002:32) {
  code: 'MODULE_NOT_FOUND',
  path: '/var/app/current/node_modules/parse-server/package.json',
  requestPath: 'parse-server'

It works when I don't point the dependency to a commit, but it doesn't work with a commit - why?


Solution

  • If you look at the Parse Server GitHub repository, you will see that there is no lib/ folder over there. The lib/ is at the .gitignore file and you will only find it in the npm package. That's why it fails when you try to install directly from the GitHub repository.

    The workaround is:

    1. Create a fork of Parse Server repository in your own GitHub account.
    2. Clone your own fork.
    3. Reset to the commit you need, run npm install.
    4. Remove the lib/ folder from .gitignore, commit, and push it to your own fork.
    5. Try the process you described again but installing from your own GitHub fork.