aws-toolkit-jetbrains icon indicating copy to clipboard operation
aws-toolkit-jetbrains copied to clipboard

Got "Error: GoModulesBuilder:Resolver" when I want to create a Lambda function by GoLand

Open BradfordSun opened this issue 2 years ago • 1 comments

  • OS:
  • JetBrains product: Windows GoLand
  • JetBrains product version: 2021.3.4
  • AWS Toolkit version: 1.41-213
  • SAM CLI version: 1.43.0
  • Go version: 1.17.8

Question

When I want to create a Lambda function by GoLand, it shows some error in the Build tab:

"C:\Program Files\Amazon\AWSSAMCLI\bin\sam.cmd" build --template C:\Users\0145\AppData\Local\Temp\temp-template4096796463320167285.yaml --build-dir C:\Users\0145\GolandProjects\Lambda\.aws-sam\build
Building codeuri: C:\Users\0145\GolandProjects\Lambda runtime: go1.x metadata: {} architecture: x86_64 functions: ['Function']

Build Failed
Error: GoModulesBuilder:Resolver - Path resolution for runtime: go1.x of binary: go was not successful
SAM Build has failed: Command did not exit successfully, exit code: 1
goland has failed: Command did not exit successfully, exit code: 1

And here is my project structure: image

Here is my simple main.go file from AWS documentation:

package main

import (
	"context"
	"fmt"
	"github.com/aws/aws-lambda-go/lambda"
)

type MyEvent struct {
	Name string `json:"name"`
}

func HandleRequest(ctx context.Context, name MyEvent) (string, error) {
	return fmt.Sprintf("Hello %s!", name.Name), nil
}

func main() {
	lambda.Start(HandleRequest)
}

Here is my settings when I created Lambda: image

May I ask why I got the error and is there any tutorial for AWS Lambda with GoLand?

Thank you in advance.

BradfordSun avatar Apr 13 '22 14:04 BradfordSun

related: #3063

rli avatar Apr 18 '22 18:04 rli