brefphp / bref

Serverless PHP on AWS Lambda
https://bref.sh
MIT License
3.05k stars 364 forks source link

Bref Serverless v4 #1815

Closed cybage-kmistry closed 6 days ago

cybage-kmistry commented 1 month ago

Description:

Serverless comes up with version 4 which is licensed one and with bref during serverless deploy it is asking to login to it. How this will be handled with bref as bref is open source from start?

How to reproduce:

serverless deploy

stloyd commented 1 month ago

There was a recent adjustment to lock it to version 3: https://github.com/brefphp/bref/pull/1812

mnapoli commented 1 month ago

Hi all, I don't know yet if Bref is compatible with Serverless Framework v4 in its current state. Unfortunately, their release of a beta as a stable tag on NPM took everyone by surprise (yes to clarify, SF v4 is still in beta). It's too bad they didn't follow SemVer. And it's too bad they cleaned up the docs as well.

There has been issues reported with plugin loading compatibility. The first releases were likely to not work with Bref. Now they have shipped some fixes, if anyone has tried it yet feel free to share your experience.

In the meantime, I have updated the Bref documentation to stay on Serverless Framework v3. The main reason is that v4 is a beta; I wouldn't recommend immediately upgrading (especially given how messy this release is right now).

I am not sure what to do for the future though (yet). I support companies trying to live off their product. However what is happening here does not bring confidence at all. Let's give it a chance.

austencollins commented 1 month ago

FWIW the Serverless Framework's intention is to support Bref, as always. We've found a bug in V4 due to our new Variable Resolver logic, and we're working on a fix. We're tracking the issue here.

austencollins commented 1 month ago

We've fixed support for the bug outlined in the issue above in this release. Bref should work with Serverless Framework V4 as of now. We'll continue to test and monitor it. Please let us know if you see any further issues.

Jimbolino commented 1 month ago

im still having a small error with the latest version. probably something with this require: https://github.com/brefphp/bref/blob/master/index.js#L171

Finishing
endpoint: ANY - [https://pml52gg7uc.execute-api.***.amazonaws.com](https://pml52gg7uc.execute-api.%2A%2A%2A.amazonaws.com/)
functions:
  web: troep-production-web (17 MB)
  artisan: troep-production-artisan (17 MB)
s:core:meta: saving meta record to global .serverless directory.
s:cli-error-handler: Cannot read properties of undefined (reading 'require')
TypeError: Cannot read properties of undefined (reading 'require')
    at process.<anonymous> (/home/runner/work/www.troep.com/www.troep.com/vendor/bref/bref/index.js:171:44)
    at process.emit (node:events:519:28)
    at process.emit (node:domain:488:12)

✖ Cannot read properties of undefined (reading 'require')
TypeError: Cannot read properties of undefined (reading 'require')
    at process.<anonymous> (/home/runner/work/www.troep.com/www.troep.com/vendor/bref/bref/index.js:171:44)
    at process.emit (node:events:519:28)
    at process.emit (node:domain:488:12)

For help, try the following:
  • Run the command again with the "--debug" option
  • Run "serverless support"
  • Review the docs: https://www.serverless.com/framework/docs/

Error: Process completed with exit code 1.
Kremzeeq commented 2 weeks ago

Hi, I can also report there's still an issue with login for the serverless framework. Here's some code I can share from using `GitHub Actions:

    - name: serverless deploy
      run: | 
        npm i -g serverless@4.0.35
        npm install && npm list -g
        serverless deploy --verbose
      env:
        SERVERLESS_ACCESS_KEY: ${{ secrets.SERVERLESS_ACCESS_KEY }}

GitHub Actions logs:

Run npm i -g serverless@4.0.35

added 53 packages in 2s

15 packages are looking for funding
  run `npm fund` for details
npm warn deprecated inflight@1.0.6: This module is not supported, and leaks memory. Do not use it. Check out lru-cache if you want a good and tested way to coalesce async requests by a key value, which is much more comprehensive and powerful.
npm warn deprecated glob@7.2.3: Glob versions prior to v9 are no longer supported
npm warn deprecated querystring@0.2.1: The querystring API is considered Legacy. new code should use the URLSearchParams API instead.
npm warn deprecated superagent@7.1.6: Please upgrade to v9.0.0+ as we have fixed a public vulnerability with formidable dependency. Note that v9.0.0+ requires Node.js v14.18.0+. See https://github.com/ladjs/superagent/pull/1800 for insight. This project is supported and maintained by the team at Forward Email @ https://forwardemail.net
npm warn deprecated querystring@0.2.0: The querystring API is considered Legacy. new code should use the URLSearchParams API instead.
npm warn deprecated querystring@0.2.0: The querystring API is considered Legacy. new code should use the URLSearchParams API instead.

added 587 packages, and audited 588 packages in 14s

113 packages are looking for funding
  run `npm fund` for details

found 0 vulnerabilities
/opt/hostedtoolcache/node/[20](https://github.com/KremzeeqOrg/fruit-project-api-scraper/actions/runs/9563233246/job/26361335677#step:7:21).14.0/x64/lib
├── corepack@0.28.1
├── npm@10.7.0
└── serverless@4.0.35

Initializing

✖ Unauthorized
Error: Unauthorized
    at Authentication.getClientDataFromAccessKey (file:///home/runner/.serverless/releases/4.1.4/package/dist/sf-core.js:1060:27526)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async Authentication.getAuthenticatedData (file:///home/runner/.serverless/releases/4.1.4/package/dist/sf-core.js:1060:10955)
    at async Authentication.resolverAuthenticate (file:///home/runner/.serverless/releases/4.1.4/package/dist/sf-core.js:1060:31012)
    at async _Meta.authenticateAndResolve (file:///home/runner/.serverless/releases/4.1.4/package/dist/sf-core.js:1068:10639)
    at async route (file:///home/runner/.serverless/releases/4.1.4/package/dist/sf-core.js:1068:14642)
    at async Object.run2 [as run] (file:///home/runner/.serverless/releases/4.1.4/package/dist/sf-core.js:1068:15090)
    at async run3 (file:///home/runner/.serverless/releases/4.1.4/package/dist/sf-core.js:1068:163[24](https://github.com/KremzeeqOrg/fruit-project-api-scraper/actions/runs/9563233246/job/26361335677#step:7:25))

For help, try the following:
  • Run the command again with the "--debug" option
  • Run "serverless support"
  • Review the docs: https://www.serverless.com/framework/docs/

If you're curious about specifics:

I've closed my pr for now, but this basically covers a migration from serverless@3.2 to serverless@4.0.35. Deploy with serverless@3.2 was working before.

austencollins commented 2 weeks ago

Hmm, @Kremzeeq We have released multiple versions since 4.0.35 Could you try again please?

austencollins commented 2 weeks ago

Thanks, @Jimbolino. It looks like there are some unconventional require statements to fetch dependencies directly from the Framework, rather than go through the APIs the Framework provides for this functionality. We'll provide a PR shortly for this.

Kremzeeq commented 1 week ago

Hmm, @Kremzeeq We have released multiple versions since 4.0.35 Could you try again please?

Hi @austencollins . I've now deployed the latest version - 4.1.7 and have tested this with a lambda. lgtm. Thanks you.

austencollins commented 6 days ago

Fix awaiting approval for the issue @Jimbolino mentioned: https://github.com/brefphp/bref/pull/1831

mnapoli commented 6 days ago

Closed by #1837