serverless-go-plugin icon indicating copy to clipboard operation
serverless-go-plugin copied to clipboard

[go1.x runtime deprecation] Endpoint request timed out

Open leonardyhuang opened this issue 1 year ago • 10 comments

Due to the go1.x runtime deprecation, I am trying to use the custom runtime provided.al2. However, the endpoint now gives the error "Endpoint request timed out" after deployment.

Any advice is appreciated.

Here is my configuration:

service: my-service

frameworkVersion: '3'

provider:
  name: aws
  runtime: provided.al2
  architecture: arm64

  stage: ${opt:stage, 'dev'}
  region: us-east-1

  environment: ${file(.env.${self:provider.stage}.yml)}

package:
  patterns:
    - '!./**'
    - './bin/**'

functions:
  receive:
    handler: receive/main.go
    events:
      - http:
          path: ${self:custom.functionPath.${self:provider.stage}}/receive
          method: post
    timeout: 30
    memorySize: 128
  verify:
    handler: verify/main.go
    events:
      - http:
          path: ${self:custom.functionPath.${self:provider.stage}}/receive
          method: get
    timeout: 30
    memorySize: 128

custom:
  go:
    supportedRuntimes: provided.al2
    buildProvidedRuntimeAsBootstrap: true
    cmd: GOARCH=arm64 GOOS=linux go build -tags lambda.norpc -ldflags="-s -w"

plugins:
  - serverless-go-plugin

leonardyhuang avatar Sep 11 '23 16:09 leonardyhuang

I'm also trying to migrate to provided.al2 but the deploy fails. I have multiple lambdas. I have noticed that using the provided.al2 runtime does not create any entry in the .bin folder. It creates one main.zip file in the .serverless folder without any bootstrap entry file. Please advise.

ivaylopivanov avatar Sep 19 '23 07:09 ivaylopivanov

there is an issue on the plugin when adding buildProvidedRuntimeAsBootstrap as true to use provided.al2 runtime, if you don't have declared old include and exclude package options. I'll send a PR in some hours to fix this

danteay avatar Sep 21 '23 16:09 danteay

I've also recommend to remove the package config and let the plugin build it for you.

danteay avatar Sep 21 '23 16:09 danteay

Here a PR with the fix!!! https://github.com/mthenw/serverless-go-plugin/pull/43

danteay avatar Oct 03 '23 19:10 danteay

Thank you @danteay, will check it next week and will let you know.

ivaylopivanov avatar Oct 04 '23 07:10 ivaylopivanov

@danteay it seems its working, thank you! Will be performing more tests and will report back if anything pops up. Just for future reference, these are the configs that I have

  go:
    cmd: GOOS=linux GOARCH=amd64 go build -ldflags="-s -w" # compile command
    supportedRuntimes: ["provided.al2"]
    buildProvidedRuntimeAsBootstrap: true

The yaml doesn't contain the package include or exclude properties.

ivaylopivanov avatar Oct 10 '23 09:10 ivaylopivanov

@ivaylopivanov how do you test it if the PR is still open?

jpsolofunds avatar Oct 18 '23 18:10 jpsolofunds

@ivaylopivanov how do you test it if the PR is still open?

You can install the plugin with npm pointing to a specific commit.

ivaylopivanov avatar Oct 19 '23 04:10 ivaylopivanov

@ivaylopivanov @jpsolofunds As my PR was ghosted I've forked and modified the plugin to just work with new AWS configuration and fix other issues that I've found in the process!!

Feel free to test it and give me feedback!!

(release will come soon)

https://github.com/Drafteame/serverless-plugin-go

danteay avatar Oct 23 '23 22:10 danteay

In my case, applying this issue's workaround did not solve the problem. The problem was caused by an old version of aws/aws-lambda-go (eg: v1.6.0 ) , and the timeout was resolved by upgrading to latest (eg: v1.41.0. ) https://github.com/aws/aws-lambda-go/releases/tag/v1.41.0

yktakaha4 avatar Nov 21 '23 06:11 yktakaha4