{"componentChunkName":"component---src-templates-platform-tsx","path":"/platforms/go/guides/fasthttp/serverless/","result":{"data":{"file":{"id":"2e0b1b46-fbfd-5cbf-acfc-9805480b22c5","relativePath":"go/common/serverless.mdx","sourceInstanceName":"platforms","childMarkdownRemark":null,"childMdx":{"body":"function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }\n\nfunction _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }\n\nfunction _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }\n\n/* @jsx mdx */\nvar _frontmatter = {\n  \"title\": \"Serverless\",\n  \"sidebar_order\": 6\n};\n\nvar makeShortcode = function makeShortcode(name) {\n  return function MDXDefaultShortcode(props) {\n    console.warn(\"Component \" + name + \" was not imported, exported, or provided by MDXProvider as global scope\");\n    return mdx(\"div\", props);\n  };\n};\n\nvar CodeTabs = makeShortcode(\"CodeTabs\");\nvar CodeBlock = makeShortcode(\"CodeBlock\");\nvar layoutProps = {\n  _frontmatter: _frontmatter\n};\nvar MDXLayout = \"wrapper\";\nreturn function MDXContent(_ref) {\n  var components = _ref.components,\n      props = _objectWithoutProperties(_ref, [\"components\"]);\n\n  return mdx(MDXLayout, _extends({}, layoutProps, props, {\n    components: components,\n    mdxType: \"MDXLayout\"\n  }), mdx(\"h3\", {\n    \"id\": \"source-context\",\n    \"style\": {\n      \"position\": \"relative\"\n    }\n  }, mdx(\"a\", _extends({\n    parentName: \"h3\"\n  }, {\n    \"href\": \"#source-context\",\n    \"aria-label\": \"source context permalink\",\n    \"className\": \"anchor before\"\n  }), mdx(\"svg\", _extends({\n    parentName: \"a\"\n  }, {\n    \"viewBox\": \"0 0 24 24\",\n    \"xmlns\": \"http://www.w3.org/2000/svg\"\n  }), mdx(\"path\", _extends({\n    parentName: \"svg\"\n  }, {\n    \"d\": \"M10.879 6.05L15 1.93A5.001 5.001 0 0 1 22.071 9l-4.121 4.121a1 1 0 0 1-1.414-1.414l4.12-4.121a3 3 0 1 0-4.242-4.243l-4.121 4.121a1 1 0 1 1-1.414-1.414zm2.242 11.9L9 22.07A5 5 0 1 1 1.929 15l4.121-4.121a1 1 0 0 1 1.414 1.414l-4.12 4.121a3 3 0 1 0 4.242 4.243l4.121-4.121a1 1 0 1 1 1.414 1.414zm-8.364-.122l13.071-13.07a1 1 0 0 1 1.415 1.414L6.172 19.242a1 1 0 1 1-1.415-1.414z\",\n    \"fill\": \"currentColor\"\n  })))), \"Source Context\"), mdx(\"p\", null, mdx(\"inlineCode\", {\n    parentName: \"p\"\n  }, \"sentry-go\"), \" SDK comes with the support for serverless solutions out of the box.\\nHowever, to get the source contexts right, you need to bundle your source code with the binary itself.\"), mdx(\"p\", null, \"For example, when using \", mdx(\"strong\", {\n    parentName: \"p\"\n  }, \"AWS Lambda\"), \" and given this tree structure:\"), mdx(\"div\", {\n    \"className\": \"code-tabs-wrapper\"\n  }, mdx(CodeTabs, {\n    mdxType: \"CodeTabs\"\n  }, mdx(CodeBlock, {\n    language: \"bash\",\n    title: \"\",\n    filename: \"\",\n    mdxType: \"CodeBlock\"\n  }, mdx(\"div\", _extends({\n    parentName: \"div\"\n  }, {\n    \"className\": \"gatsby-highlight\",\n    \"data-language\": \"bash\"\n  }), mdx(\"pre\", _extends({\n    parentName: \"div\"\n  }, {\n    \"className\": \"language-bash\"\n  }), mdx(\"code\", _extends({\n    parentName: \"pre\"\n  }, {\n    \"className\": \"language-bash\"\n  }), mdx(\"span\", _extends({\n    parentName: \"code\"\n  }, {\n    \"className\": \"token builtin class-name\"\n  }), \".\"), \"\\n\\u251C\\u2500\\u2500 bin\\n\\u2502   \\u2514\\u2500\\u2500 upload-image\\n\\u2502   \\u2514\\u2500\\u2500 process-image\\n\\u2502   \\u2514\\u2500\\u2500 create-thumbnails\\n\\u251C\\u2500\\u2500 functions\\n\\u2502   \\u2514\\u2500\\u2500 upload-image\\n\\u2502       \\u2514\\u2500\\u2500 main.go\\n\\u2502   \\u2514\\u2500\\u2500 process-image\\n\\u2502       \\u2514\\u2500\\u2500 main.go\\n\\u2502   \\u2514\\u2500\\u2500 create-thumbnails\\n\\u2502       \\u2514\\u2500\\u2500 main.go\\n\\u251C\\u2500\\u2500 helper\\n\\u2502   \\u251C\\u2500\\u2500 foo.go\\n\\u2502   \\u2514\\u2500\\u2500 bar.go\\n\\u251C\\u2500\\u2500 util\\n\\u2502   \\u251C\\u2500\\u2500 baz.go\\n\\u2502   \\u2514\\u2500\\u2500 qux.go\\n\")))))), mdx(\"p\", null, \"You can build one of the binaries and bundle them with the necessary source files with this command:\"), mdx(\"div\", {\n    \"className\": \"code-tabs-wrapper\"\n  }, mdx(CodeTabs, {\n    mdxType: \"CodeTabs\"\n  }, mdx(CodeBlock, {\n    language: \"bash\",\n    title: \"\",\n    filename: \"\",\n    mdxType: \"CodeBlock\"\n  }, mdx(\"div\", _extends({\n    parentName: \"div\"\n  }, {\n    \"className\": \"gatsby-highlight\",\n    \"data-language\": \"bash\"\n  }), mdx(\"pre\", _extends({\n    parentName: \"div\"\n  }, {\n    \"className\": \"language-bash\"\n  }), mdx(\"code\", _extends({\n    parentName: \"pre\"\n  }, {\n    \"className\": \"language-bash\"\n  }), mdx(\"span\", _extends({\n    parentName: \"code\"\n  }, {\n    \"className\": \"token assign-left variable\"\n  }), \"GOOS\"), mdx(\"span\", _extends({\n    parentName: \"code\"\n  }, {\n    \"className\": \"token operator\"\n  }), \"=\"), \"linux go build -o bin/upload-image functions/upload-image/main.go \", mdx(\"span\", _extends({\n    parentName: \"code\"\n  }, {\n    \"className\": \"token operator\"\n  }), \"&&\"), \" \", mdx(\"span\", _extends({\n    parentName: \"code\"\n  }, {\n    \"className\": \"token function\"\n  }), \"zip\"), \" -r handler.zip bin/upload-image functions/upload-image/ helper/ util/\")))))), mdx(\"p\", null, \"The only requirement is that you locate the source code on the deployed machine. Everything else should be done automatically by the SDK.\"), mdx(\"h3\", {\n    \"id\": \"events-delivery\",\n    \"style\": {\n      \"position\": \"relative\"\n    }\n  }, mdx(\"a\", _extends({\n    parentName: \"h3\"\n  }, {\n    \"href\": \"#events-delivery\",\n    \"aria-label\": \"events delivery permalink\",\n    \"className\": \"anchor before\"\n  }), mdx(\"svg\", _extends({\n    parentName: \"a\"\n  }, {\n    \"viewBox\": \"0 0 24 24\",\n    \"xmlns\": \"http://www.w3.org/2000/svg\"\n  }), mdx(\"path\", _extends({\n    parentName: \"svg\"\n  }, {\n    \"d\": \"M10.879 6.05L15 1.93A5.001 5.001 0 0 1 22.071 9l-4.121 4.121a1 1 0 0 1-1.414-1.414l4.12-4.121a3 3 0 1 0-4.242-4.243l-4.121 4.121a1 1 0 1 1-1.414-1.414zm2.242 11.9L9 22.07A5 5 0 1 1 1.929 15l4.121-4.121a1 1 0 0 1 1.414 1.414l-4.12 4.121a3 3 0 1 0 4.242 4.243l4.121-4.121a1 1 0 1 1 1.414 1.414zm-8.364-.122l13.071-13.07a1 1 0 0 1 1.415 1.414L6.172 19.242a1 1 0 1 1-1.415-1.414z\",\n    \"fill\": \"currentColor\"\n  })))), \"Events Delivery\"), mdx(\"p\", null, \"Most (if not all) serverless solutions won't wait for network responses before closing the process.\\nBecause of that, we need to make sure that the event is delivered to Sentry's severs.\"), mdx(\"p\", null, \"It can be achieved twofold, using the \", mdx(\"inlineCode\", {\n    parentName: \"p\"\n  }, \"sentry.Flush\"), \" method or by swapping the transport to \", mdx(\"inlineCode\", {\n    parentName: \"p\"\n  }, \"HTTPSyncTransport\"), \".\\nBoth ways are described in the \", mdx(\"a\", _extends({\n    parentName: \"p\"\n  }, {\n    \"href\": \"/platforms/go/#usage\"\n  }), \"Usage\"), \" section of this documentation.\"));\n}\n;\nMDXContent.isMDXComponent = true;","tableOfContents":{"items":[{"url":"#source-context","title":"Source Context"},{"url":"#events-delivery","title":"Events Delivery"}]},"internal":{"type":"Mdx"}}}},"pageContext":{"excerpt":"Source Context sentry-go  SDK comes with the support for serverless solutions out of the box.\nHowever, to get the source contexts right, you need to bundle your source code with the binary itself. For example, when using  AWS Lambda  and given this tree structure: You can build one of the binaries and bundle them with the necessary source files with this command: The only requirement is that you locate the source code on the deployed machine. Everything else should be done automatically by the SDK. Events Delivery Most (if not all) serverless solutions won't wait for network responses before closing the process.\nBecause of that, we need to make sure that the event is delivered to Sentry's severs. It can be achieved twofold, using the  sentry.Flush  method or by swapping the transport to  HTTPSyncTransport .\nBoth ways are described in the  Usage  section of this documentation.","title":"Serverless","sidebar_order":6,"platform":{"name":"go","title":"Go"},"guide":{"name":"fasthttp","title":"FastHTTP"},"noindex":true,"notoc":true,"redirect_from":[],"id":"2e0b1b46-fbfd-5cbf-acfc-9805480b22c5"}},"staticQueryHashes":["1218203755","1222113826","1222113826","1766336459","2158593473","2404336828","2472290386","2764967025","3818502851","4015007367","4192517163","4264099332","518019976"]}