amplify-cli icon indicating copy to clipboard operation
amplify-cli copied to clipboard

Golang `mock` tcp :8900: connect: connection refused

Open 0618 opened this issue 1 year ago • 1 comments

How did you install the Amplify CLI?

yarn

If applicable, what version of Node.js are you using?

v18.19.0

Amplify CLI Version

12.10.2

What operating system are you using?

Mac

Did you make any manual changes to the cloud resources managed by Amplify? Please describe the changes made.

N/A

Describe the bug

when running amplify mock function <functionID> --event src/event.json, got error

tcp :8900: connect: connection refused

Expected behavior

when running amplify mock function <functionID> --event src/event.json, lambda should work as expected.

Reproduction steps

  1. in a new folder, yarn init -y
  2. amplify init -y
  3. amplify add function, choose go.
  4. run amplify mock function <functionID> --event src/event.json, see the error.

Project Identifier

No response

Log output

# Put your logs below this line


Additional information

No response

Before submitting, please confirm:

  • [X] I have done my best to include a minimal, self-contained set of instructions for consistently reproducing the issue.
  • [X] I have removed any sensitive information from my code snippets and submission.

0618 avatar Apr 03 '24 21:04 0618

mock doesn't work because our Go Runtime has already upgraded from go1.x (https://github.com/aws-amplify/amplify-cli/pull/13671), which means the RPC we use for mock doesn't work anymore.

ref:

  • how we use RPC for the mock https://djharper.dev/post/2018/01/27/running-go-aws-lambda-functions-locally/

0618 avatar Apr 03 '24 23:04 0618