bref icon indicating copy to clipboard operation
bref copied to clipboard

Bref Serverless v4

Open cybage-kmistry opened this issue 1 year ago • 8 comments

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

cybage-kmistry avatar May 23 '24 05:05 cybage-kmistry

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

stloyd avatar May 23 '24 05:05 stloyd

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.

mnapoli avatar May 24 '24 19:05 mnapoli

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 avatar May 31 '24 22:05 austencollins

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.

austencollins avatar Jun 05 '24 21:06 austencollins

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.

Jimbolino avatar Jun 08 '24 14:06 Jimbolino

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 [email protected]
        npm install && npm list -g
        serverless deploy --verbose
      env:
        SERVERLESS_ACCESS_KEY: ${{ secrets.SERVERLESS_ACCESS_KEY }}

GitHub Actions logs:

Run npm i -g [email protected]

added 53 packages in 2s

15 packages are looking for funding
  run `npm fund` for details
npm warn deprecated [email protected]: 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 [email protected]: Glob versions prior to v9 are no longer supported
npm warn deprecated [email protected]: The querystring API is considered Legacy. new code should use the URLSearchParams API instead.
npm warn deprecated [email protected]: 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 [email protected]: The querystring API is considered Legacy. new code should use the URLSearchParams API instead.
npm warn deprecated [email protected]: 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
├── [email protected]
├── [email protected]
└── [email protected]


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:

  • https://github.com/KremzeeqOrg/fruit-project-api-scraper/pull/3/files
  • https://github.com/KremzeeqOrg/fruit-project-api-scraper/actions/runs/9563233246/job/26361335677

I've closed my pr for now, but this basically covers a migration from [email protected] to [email protected]. Deploy with [email protected] was working before.

Kremzeeq avatar Jun 18 '24 10:06 Kremzeeq

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

austencollins avatar Jun 18 '24 17:06 austencollins

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.

austencollins avatar Jun 18 '24 17:06 austencollins

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.

Kremzeeq avatar Jul 01 '24 10:07 Kremzeeq

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

austencollins avatar Jul 01 '24 15:07 austencollins

Closed by #1837

mnapoli avatar Jul 02 '24 10:07 mnapoli

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.

I faced the same issue but managed to resolve it by updating Bref to version 2.3.0.

amiretemad avatar Jul 15 '24 14:07 amiretemad