{"action":"closed","issue":{"url":"https://api.github.com/repos/awslabs/aws-sam-local/issues/326","repository_url":"https://api.github.com/repos/awslabs/aws-sam-local","labels_url":"https://api.github.com/repos/awslabs/aws-sam-local/issues/326/labels{/name}","comments_url":"https://api.github.com/repos/awslabs/aws-sam-local/issues/326/comments","events_url":"https://api.github.com/repos/awslabs/aws-sam-local/issues/326/events","html_url":"https://github.com/awslabs/aws-sam-local/issues/326","id":304466036,"number":326,"title":"Debugging SAM Local + Java in IntelliJ","user":{"login":"debuggins","id":37190507,"avatar_url":"https://avatars1.githubusercontent.com/u/37190507?v=4","gravatar_id":"","url":"https://api.github.com/users/debuggins","html_url":"https://github.com/debuggins","followers_url":"https://api.github.com/users/debuggins/followers","following_url":"https://api.github.com/users/debuggins/following{/other_user}","gists_url":"https://api.github.com/users/debuggins/gists{/gist_id}","starred_url":"https://api.github.com/users/debuggins/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/debuggins/subscriptions","organizations_url":"https://api.github.com/users/debuggins/orgs","repos_url":"https://api.github.com/users/debuggins/repos","events_url":"https://api.github.com/users/debuggins/events{/privacy}","received_events_url":"https://api.github.com/users/debuggins/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":2,"created_at":"2018-03-12T17:22:56Z","updated_at":"2018-03-13T06:45:44Z","closed_at":"2018-03-13T06:45:44Z","author_association":"NONE","body":"I am unable to hit breakpoints in IntelliJ (ver 14.1.7). I am using a Mac (ver. 10.13.3), SAM (ver. 0.2.8), and Docker (ver. 17.12.0-ce, build c97c6d6).\r\n\r\nAfter starting sam local and then hitting the endpoint in Chrome, my console output is this:\r\n```$ sam local start-api --debug-port 3000\r\n2018/03/09 14:02:18 Connected to Docker 1.35\r\n2018/03/09 14:02:18 Fetching lambci/lambda:java8 image for java8 runtime...\r\njava8: Pulling from lambci/lambda\r\nDigest: sha256:e1c82c7707c28f533480c76bb93a010f2279f699a0d7f8d3e9727082e0a81051\r\nStatus: Image is up to date for lambci/lambda:java8\r\n\r\nMounting com.amazonaws.lambda.hw.LambdaFunctionHandler::handleRequest (java8) at http://127.0.0.1:3000/ [GET]\r\n\r\nYou can now browse to the above endpoints to invoke your functions.\r\nYou do not need to restart/reload SAM CLI while working on your functions,\r\nchanges will be reflected instantly/automatically. You only need to restart\r\nSAM CLI if you update your AWS SAM template.\r\n\r\n2018/03/09 14:02:24 Invoking com.amazonaws.lambda.hw.LambdaFunctionHandler::handleRequest (java8)\r\n2018/03/09 14:02:24 Decompressing /***/Hello World/target/hw-1.0.0.jar\r\n2018/03/09 14:02:26 Mounting /private/var/folders/pr/zzhpj48x70l0gk6n1t11x74m0000gn/T/aws-sam-local-1520632944922829000 as /var/task:ro inside runtime container\r\n```\r\nIt hangs after mounting and the page never loads.\r\n\r\nMy template.yaml looks like this:\r\n```AWSTemplateFormatVersion : '2010-09-09'\r\nTransform: AWS::Serverless-2016-10-31\r\nDescription: \r\n\r\nResources:\r\n  GetFunction:\r\n    Type: AWS::Serverless::Function\r\n    Properties:\r\n      FunctionName: handleRequest\r\n      Handler: com.amazonaws.lambda.hw.LambdaFunctionHandler::handleRequest\r\n      Runtime: java8\r\n      CodeUri: target/hw-1.0.0.jar\r\n      Timeout: 300\r\n      Events:\r\n        GetEvent:\r\n          Type: Api\r\n          Properties:\r\n            Path: /\r\n            Method: get\r\n```\r\n\r\nMy LambdaFunctionHandler.java looks like this:\r\n```package com.amazonaws.lambda.hw;\r\n\r\nimport com.amazonaws.services.lambda.runtime.Context;\r\nimport com.amazonaws.services.lambda.runtime.RequestHandler;\r\nimport org.json.simple.JSONObject;\r\n\r\npublic class LambdaFunctionHandler implements RequestHandler<Object, String> {\r\n\r\n    @Override\r\n    public String handleRequest(Object input, Context context) {\r\n        JSONObject obj = new JSONObject();\r\n        obj.put(\"statusCode\", 200);\r\n        JSONObject headers = new JSONObject();\r\n        headers.put(\"x-custom-header\", \"my custom header value\");\r\n        obj.put(\"headers\", headers);\r\n        obj.put(\"body\", \"Hello from Lambda!\");\r\n\r\n        return obj.toJSONString();\r\n    }\r\n}\r\n````\r\n\r\nRemote Configuration Settings:\r\nTransport: Socket\r\nDebugger mode: Attach\r\nHost: 127.0.01\r\nPort: 3000\r\n\r\nInvoking the function works fine with a default generated event file, but won't hit the breakpoints. Console output below:\r\n```$ sam local invoke GetFunction --event evt.json\r\n2018/03/12 10:15:57 Successfully parsed template.yml\r\n2018/03/12 10:15:57 Connected to Docker 1.35\r\n2018/03/12 10:15:57 Fetching lambci/lambda:java8 image for java8 runtime...\r\njava8: Pulling from lambci/lambda\r\nDigest: sha256:c2ec8db145bbe44154dbddcdd2976ab8afd60d58d7d633dc98f53f657c0ef909\r\nStatus: Image is up to date for lambci/lambda:java8\r\n2018/03/12 10:15:59 Invoking com.amazonaws.lambda.hw.LambdaFunctionHandler::handleRequest (java8)\r\n2018/03/12 10:15:59 Decompressing /***/Hello World/target/hw-1.0.0.jar\r\n2018/03/12 10:16:00 Mounting /private/var/folders/pr/zzhpj48x70l0gk6n1t11x74m0000gn/T/aws-sam-local-1520874959484468000 as /var/task:ro inside runtime container\r\nSTART RequestId: 28e2a514-e190-4bec-9681-fa194d91e654 Version: $LATEST\r\nEND RequestId: 28e2a514-e190-4bec-9681-fa194d91e654\r\nREPORT RequestId: 28e2a514-e190-4bec-9681-fa194d91e654  Duration: 44.77 ms      Billed Duration: 100 ms Memory Size: 128 MB     Max Memory Used: 9 MB   \r\n\r\n\"{\\\"headers\\\":{\\\"x-custom-header\\\":\\\"my custom header value\\\"},\\\"body\\\":\\\"Hello from Lambda!\\\",\\\"statusCode\\\":200}\"\r\n```\r\n\r\nThis is my first time trying to debug something remotely so I'm not sure what I'm doing wrong. Can anyone help? Thanks in advance."}}
{"actor":{"display_login":"PaulMaddox"}}