phpamazon-web-servicesserverlessbref

Serverless PHP on AWS with bref deployment error


I recently discovered what promises to be the holy grail of PHP development on AWS Lambda. It's a tool called "bref" which simplifies the way PHP apps are deployed to the cloud.

The online documentation has simple and clear instructions to follow here: https://bref.sh/docs/first-steps.html

Unfortunately, I get the following error when deploying (sls deploy):

Serverless plugin "./vendor/bref/bref" initialization errored: Cannot find module './vendor/bref/bref'
Require stack:
- /usr/local/lib/node_modules/serverless/lib/classes/PluginManager.js
- /usr/local/lib/node_modules/serverless/lib/Serverless.js
- /usr/local/lib/node_modules/serverless/lib/utils/autocomplete.js
- /usr/local/lib/node_modules/serverless/bin/serverless

This error appears to say that there are some missing npm packages but the documentation on the bref website does not address any additional packages to be installed. What am I doing wrong here?


Solution

  • I already had PHP version 7.3 installed. The problem was having an old version of Serverless Framework. But in order for me to upgrade my version of Serverless, I had to first upgrade NPM as well.

    npm i -g npm
    

    Then I could upgrade Serverless Framework:

    npm install -g serverless@latest