{"id":59,"date":"2022-02-13T06:52:16","date_gmt":"2022-02-13T06:52:16","guid":{"rendered":"https:\/\/im8bit.com\/?p=59"},"modified":"2022-02-13T08:49:51","modified_gmt":"2022-02-13T08:49:51","slug":"aws-golang-lambda-using-macos","status":"publish","type":"post","link":"https:\/\/im8bit.com\/?p=59","title":{"rendered":"AWS golang Lambda using macOS"},"content":{"rendered":"\n<p>If you happen to be trying to create a Lambda function in golang, you might endup getting this error:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>{\n  \"errorMessage\": \"fork\/exec \/var\/task\/main: exec format error\",\n  \"errorType\": \"PathError\"\n}<\/code><\/pre>\n\n\n\n<p>If that&#8217;s how you ended up in this corner of the web let me point you in the right direction. Here: <a href=\"https:\/\/docs.aws.amazon.com\/lambda\/latest\/dg\/golang-package.html\">https:\/\/docs.aws.amazon.com\/lambda\/latest\/dg\/golang-package.html<\/a><\/p>\n\n\n\n<p>The problem was that I didn&#8217;t read the section &#8220;Creating a .zip file on macOS and Linux&#8221;, you have to let go know that this will run on linux:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>GOOS=linux go build main.go<\/code><\/pre>\n\n\n\n<p>Once you do that, zip the executable (just the executable!) and upload it to AWS.<\/p>\n\n\n\n<p>You are good to go now!<\/p>\n","protected":false},"excerpt":{"rendered":"<p>If you happen to be trying to create a Lambda function in golang, you might endup getting this error: If that&#8217;s how you ended up in this corner of the web let me point you in the right direction. Here: https:\/\/docs.aws.amazon.com\/lambda\/latest\/dg\/golang-package.html The problem was that I didn&#8217;t read the section &#8220;Creating a .zip file on &#8230; <a class=\"read-more\" href=\"https:\/\/im8bit.com\/?p=59\">Read More<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[2],"tags":[],"class_list":["post-59","post","type-post","status-publish","format-standard","hentry","category-blog"],"_links":{"self":[{"href":"https:\/\/im8bit.com\/index.php?rest_route=\/wp\/v2\/posts\/59","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/im8bit.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/im8bit.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/im8bit.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/im8bit.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=59"}],"version-history":[{"count":2,"href":"https:\/\/im8bit.com\/index.php?rest_route=\/wp\/v2\/posts\/59\/revisions"}],"predecessor-version":[{"id":62,"href":"https:\/\/im8bit.com\/index.php?rest_route=\/wp\/v2\/posts\/59\/revisions\/62"}],"wp:attachment":[{"href":"https:\/\/im8bit.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=59"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/im8bit.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=59"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/im8bit.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=59"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}