You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm struggling to make it work with AWS lambda, this same image I can start and execute the process on my own compute, but when it is deployed the error bellow shows up.
Main content
launcherConfig:=cmd.launcherConfig()
deferlauncherConfig.Cleanup()
deferlauncherConfig.Kill()
u:=launcherConfig.MustLaunch()
log.Print("Browser Config")
browser:=rod.New().ControlURL(u).MustConnect()
deferbrowser.MustClose()
log.Print("Accessing Page")
page, err:=stealth.Page(browser) // Point where the code fail in aws lambdaiferr!=nil {
log.Print(err.Error())
panic(err.Error())
}
page.MustNavigate("https://agenciavirtual.neoenergia.com/#/login")
My launcher config
func (cmd*CoelbaV1Command) launcherConfig() *launcher.Launcher {
ifos.Getenv("ENV") =="PROD" {
// Do not change this setup, its used to run in container with aws lambdabrowserPath:=os.Getenv("ROD_BROWSER_PATH")
u:=launcher.New().
Bin(browserPath).
NoSandbox(true).
Headless(true).
Leakless(true)
returnu
}
// Use this setup to execute localyu:=launcher.New().
Headless(true)
returnu
}
Docker Setup
# Etapa 1: Construção do binário da LambdaFROM public.ecr.aws/docker/library/golang:1.23-alpine AS build
WORKDIR /app
COPY go.mod go.sum ./
RUN go mod tidy
COPY . .
# Compila o executável para AWS LambdaRUN env GOOS=linux GOARCH=amd64 \
go build -o /main cmd/lambda_handler/main.go
# Etapa 2: Instalação do Chromium e BrotliFROM public.ecr.aws/lambda/provided:al2023 AS chromium
# Instala Brotli diretamente via DNF (sem compilar do zero)RUN dnf install -y brotli wget && dnf clean all
# Baixa e descomprime o ChromiumRUN wget --progress=dot:giga https://raw.githubusercontent.com/alixaxel/chrome-aws-lambda/master/bin/chromium.br -O /chromium.br && \
brotli -d /chromium.br && \
chmod +x /chromium
# Etapa 3: Criação da imagem finalFROM public.ecr.aws/lambda/provided:al2023
# Instala dependências mínimas para o Chromium no AL2023RUN dnf install -y \
libX11 \
libXcomposite \
libXcursor \
libXdamage \
libXrandr \
libXtst \
cairo \
pango \
gtk3 \
alsa-lib \
nss \
libgbm \
fontconfig \
&& dnf clean all
# Copia o Chromium descomprimidoCOPY --from=chromium /chromium /opt/chromium
RUN chmod 777 /opt/chromium
# Copia o binário compilado da LambdaCOPY --from=build /main /main
ENTRYPOINT ["/main"]
28 MD022/blanks-around-headings/blanks-around-headers Headings should be surrounded by blank lines [Expected: 1; Actual: 0; Below] [Context: "## My launcher config"]
29 MD031/blanks-around-fences Fenced code blocks should be surrounded by blank lines [Context: "```go"]
Rod Version: v0.116.2
I'm struggling to make it work with AWS lambda, this same image I can start and execute the process on my own compute, but when it is deployed the error bellow shows up.
Main content
My launcher config
Docker Setup
The Error track by aws
The text was updated successfully, but these errors were encountered: