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
Which Category is your question related to?
Functions
Amplify CLI Version
4.29.0
Provide additional details e.g. code snippets
Hi, I want to integrate a Lambda written in Go to my amplify project.
It is split in multiple files in a same package, which worked well with AWS SAM.
But it doesn't seems to be supported with amplify.
Here is the error I get when I want to build the sample code below:
amplify build function tryToCompileGo
⠙ Building resources. This may take a few minutes...# command-line-arguments
./main.go:15:2: undefined: HelloTest
✖ An error occurred when building the resources.
Error: Command failed with exit code 2: go build -o /Users/maxime/workspace/myproject/amplify/backend/function/tryToCompileGo/bin/main main.go
at makeError (/Users/maxime/.config/yarn/global/node_modules/execa/lib/error.js:59:11)
at Object.module.exports.sync (/Users/maxime/.config/yarn/global/node_modules/execa/index.js:188:17)
at Object.exports.executeCommand (/Users/maxime/.config/yarn/global/node_modules/amplify-go-function-runtime-provider/src/runtime.ts:24:24)
at Object.exports.buildResourceInternal (/Users/maxime/.config/yarn/global/node_modules/amplify-go-function-runtime-provider/src/runtime.ts:108:5)
at Object.exports.buildResource (/Users/maxime/.config/yarn/global/node_modules/amplify-go-function-runtime-provider/src/runtime.ts:161:3)
at Object.build (/Users/maxime/.config/yarn/global/node_modules/amplify-go-function-runtime-provider/src/index.ts:23:23)
at buildResource (/Users/maxime/.config/yarn/global/node_modules/amplify-provider-awscloudformation/lib/build-resources.js:49:36)
at processTicksAndRejections (internal/process/task_queues.js:97:5)
at async Promise.all (index 0)
at async Promise.all (index 0)
There was an error building the function resources
If the command triggered by amplify were
go build -o /Users/maxime/workspace/myproject/amplify/backend/function/tryToCompileGo/bin/main .
instead of
go build -o /Users/maxime/workspace/myproject/amplify/backend/function/tryToCompileGo/bin/main main.go
It would work
Code
src/hello.go
package main
func HelloTest() {
println("Hello !")
}
src/main.go
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) {
HelloTest()
return fmt.Sprintf("Hello %s!", name.Name), nil
}
func main() {
lambda.Start(HandleRequest)
}
go.mod
module lambda
go 1.14
require github.com/aws/aws-lambda-go v1.19.1
Which Category is your question related to?
Functions
Amplify CLI Version
4.29.0
Provide additional details e.g. code snippets
Hi, I want to integrate a Lambda written in Go to my amplify project.
It is split in multiple files in a same package, which worked well with AWS SAM.
But it doesn't seems to be supported with amplify.
Here is the error I get when I want to build the sample code below:
If the command triggered by amplify were
instead of
It would work
Code
src/hello.go
src/main.go
go.mod
tryToCompileGo-cloudformation-template.json (truncated)
The text was updated successfully, but these errors were encountered: