Sparticuz / chromium

Chromium (x86-64) for Serverless Platforms
MIT License
956 stars 67 forks source link

Does this plugin it work with serverless v4.1? #279

Closed dohomi closed 2 months ago

dohomi commented 3 months ago

What would you like to have implemented?

Is this plugin working with serverless v4? I tried the example based on https://github.com/Sparticuz/chromium/tree/master/examples/serverless-with-preexisting-lambda-layer with a very minimal reproduction to just open a browser and receive

Cannot find module '@sparticuz/chromium'

when deployed online to AWS. Running it locally due to the devDependencies it works. I use a MacOS to run the script and uploaded the zip release of 123.0.1 of your release page

Thanks for any hint!

dohomi commented 3 months ago

This is how my serverless.yml looks like

provider:
  name: aws
  runtime: nodejs20.x
  stage: dev
  region: eu-central-1

functions:
  hello:
    handler: handler.hello
    timeout: 30
    layers:
      - arn:aws:lambda:eu-central-1:XXX:layer:chromiumLayer:3
    events:
      - httpApi:
          path: /
          method: get

If I remove

devDependencies:{
 "@sparticuz/chromium": "110.0.0"
}

then sls deploy and sls invoke -f hello works as intended, but I can't use sls dev and invoke the function locally. I guess this is the problem with x86 and arm? As soon I add the @sparticuz/chromium devDependency to my package.json the local code runs but the online deployed version fails.

I am new to serverless, I might just overlook something obvious?

Sparticuz commented 2 months ago

This program won't function on any of the M series macs. https://github.com/Sparticuz/chromium?tab=readme-ov-file#running-locally--headlessheadful-mode