{"action":"created","issue":{"url":"https://api.github.com/repos/awslabs/aws-serverless-express/issues/109","repository_url":"https://api.github.com/repos/awslabs/aws-serverless-express","labels_url":"https://api.github.com/repos/awslabs/aws-serverless-express/issues/109/labels{/name}","comments_url":"https://api.github.com/repos/awslabs/aws-serverless-express/issues/109/comments","events_url":"https://api.github.com/repos/awslabs/aws-serverless-express/issues/109/events","html_url":"https://github.com/awslabs/aws-serverless-express/issues/109","id":280720679,"number":109,"title":"aws-serverless-express + serverless-offline plugin = server error listen EACCES /tmp/server0.sock","user":{"login":"dpapukchiev","id":10888563,"avatar_url":"https://avatars0.githubusercontent.com/u/10888563?v=4","gravatar_id":"","url":"https://api.github.com/users/dpapukchiev","html_url":"https://github.com/dpapukchiev","followers_url":"https://api.github.com/users/dpapukchiev/followers","following_url":"https://api.github.com/users/dpapukchiev/following{/other_user}","gists_url":"https://api.github.com/users/dpapukchiev/gists{/gist_id}","starred_url":"https://api.github.com/users/dpapukchiev/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dpapukchiev/subscriptions","organizations_url":"https://api.github.com/users/dpapukchiev/orgs","repos_url":"https://api.github.com/users/dpapukchiev/repos","events_url":"https://api.github.com/users/dpapukchiev/events{/privacy}","received_events_url":"https://api.github.com/users/dpapukchiev/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":7,"created_at":"2017-12-09T13:46:35Z","updated_at":"2018-02-09T22:11:43Z","closed_at":"2018-02-09T22:11:43Z","author_association":"NONE","body":"I am experimenting running the [aws-serverless-express](https://github.com/awslabs/aws-serverless-express) module in combination with the [serverless-offline plugin](https://github.com/dherault/serverless-offline) for the [serverless framework](https://serverless.com/). This combination results in a critical error upon sending the request to the corresponding path and not when the ```serverless offline start``` command is run. Testing the offline plugin with another route not using the aws-serverless-express module runs fine and gives me a response. This is what I have: \r\n### package.json\r\n```\r\n{\r\n  \"name\": \"ExpresssLambdaServerless\",\r\n  \"version\": \"1.0.0\",\r\n  \"description\": \"\",\r\n  \"main\": \"index.js\",\r\n  \"scripts\": {},\r\n  \"keywords\": [],\r\n  \"author\": \"\",\r\n  \"license\": \"ISC\",\r\n  \"dependencies\": {\r\n    \"aws-serverless-express\": \"^3.0.2\",\r\n    \"express\": \"^4.16.2\"\r\n  },\r\n  \"devDependencies\": {\r\n    \"serverless-offline\": \"^3.16.0\"\r\n  }\r\n}\r\n```\r\n### serverless.yml\r\n```\r\nservice: aws-nodejs \r\nprovider:\r\n  name: aws\r\n  runtime: nodejs6.10\r\nfunctions:\r\n  helloExpress:\r\n    handler: index.handlerExpress\r\n    events:\r\n      - http: GET express\r\n  helloPlain:\r\n    handler: index.handlerPlain\r\n    events:\r\n      - http: GET plain\r\nplugins:\r\n  - serverless-offline\r\n``` \r\n### index.js\r\n```\r\n'use strict';\r\nconst awsServerlessExpress = require('aws-serverless-express');\r\nconst app = require('./app');\r\nconst server = awsServerlessExpress.createServer(app);\r\n\r\n// does NOT work\r\nexports.handlerExpress = (event, context, callback) => awsServerlessExpress.proxy(server, event, callback);\r\n// works\r\nexports.handlerPlain = (event, context, callback) => {\r\n\r\n\tcallback(null, { \r\n\t\tstatusCode: 200, \r\n\t\tbody: JSON.stringify({\r\n\t\t works: true\r\n\t\t}) \r\n\t});\r\n};\r\n```\r\n### app.js\r\n```\r\n'use strict';\r\nconst express = require('express');\r\nconst awsServerlessExpressMiddleware = require('aws-serverless-express/middleware');\r\nconst app = express();\r\napp.get('/express', (req, res) => {\r\n  \r\n  res.status(200).json({\r\n    works: false\r\n  });\r\n});\r\nmodule.exports = app;\r\n```\r\n\r\n### Console output: \r\n##### Git bash as admin on Windows 10\r\n##### node -v: ```v8.9.0```\r\n```\r\n$ sls offline start\r\nServerless: Starting Offline: dev/us-east-1.\r\n\r\nServerless: Routes for helloExpress:\r\nServerless: GET /express\r\n\r\nServerless: Routes for helloPlain:\r\nServerless: GET /plain\r\n\r\nServerless: Offline listening on http://localhost:3000\r\n\r\nServerless: GET /plain (λ: helloPlain)\r\nServerless: The first request might take a few extra seconds\r\nServerless: [200] {\"statusCode\":200,\"body\":\"{\\\"works\\\":true}\"}\r\n\r\nServerless: GET /express (λ: helloExpress)\r\nServerless: The first request might take a few extra seconds\r\nERROR: server error\r\n{ Error: listen EACCES /tmp/server0.sock\r\n    at Object._errnoException (util.js:1024:11)\r\n    at _exceptionWithHostPort (util.js:1046:20)\r\n    at Server.setupListenHandle [as _listen2] (net.js:1334:19)\r\n    at listenInCluster (net.js:1392:12)\r\n    at Server.listen (net.js:1487:5)\r\n    at startServer (my-pc-path\\node_modules\\aws-serverless-express\\index.js:136:19)\r\n    at Object.proxy (my-pc-path\\node_modules\\aws-serverless-express\\index.js:175:16)\r\n    at exports.handlerExpress (my-pc-path\\index.js:7:67)\r\n    at handler (my-pc-path\\node_modules\\serverless-offline\\src\\index.js:751:25)\r\n    at Object.internals.handler (my-pc-path\\node_modules\\hapi\\lib\\handler.js:96:36)\r\n    at request._protect.run (my-pc-path\\node_modules\\hapi\\lib\\handler.js:30:23)\r\n    at module.exports.internals.Protect.internals.Protect.run (my-pc-path\\node_modules\\hapi\\lib\\protect.js:64:5)\r\n    at exports.execute (my-pc-path\\node_modules\\hapi\\lib\\handler.js:24:22)\r\n    at each (my-pc-path\\node_modules\\hapi\\lib\\request.js:384:16)\r\n    at iterate (my-pc-path\\node_modules\\items\\lib\\index.js:36:13)\r\n    at done (my-pc-path\\node_modules\\items\\lib\\index.js:28:25)\r\n    at module.exports.internals.Auth.internals.Auth._authenticate (my-pc-path\\node_modules\\hapi\\lib\\auth.js:210:16)\r\n    at internals.Auth.authenticate (my-pc-path\\node_modules\\hapi\\lib\\auth.js:202:17)\r\n    at each (my-pc-path\\node_modules\\hapi\\lib\\request.js:384:16)\r\n    at iterate (my-pc-path\\node_modules\\items\\lib\\index.js:36:13)\r\n    at done (my-pc-path\\node_modules\\items\\lib\\index.js:28:25)\r\n    at internals.state (my-pc-path\\node_modules\\hapi\\lib\\route.js:357:16)\r\n    at each (my-pc-path\\node_modules\\hapi\\lib\\request.js:384:16)\r\n    at iterate (my-pc-path\\node_modules\\items\\lib\\index.js:36:13)\r\n    at Object.exports.serial (my-pc-path\\node_modules\\items\\lib\\index.js:39:9)\r\n    at internals.Request._lifecycle (my-pc-path\\node_modules\\hapi\\lib\\request.js:387:11)\r\n    at internals.Request._execute (my-pc-path\\node_modules\\hapi\\lib\\request.js:302:21)\r\n    at Domain.request._protect.enter (my-pc-path\\node_modules\\hapi\\lib\\connection.js:261:25)\r\n    at Domain.run (domain.js:242:14)\r\n    at module.exports.internals.Protect.internals.Protect.enter (my-pc-path\\node_modules\\hapi\\lib\\protect.js:80:17)\r\n    at Server.<anonymous> (my-pc-path\\node_modules\\hapi\\lib\\connection.js:259:30)\r\n    at emitTwo (events.js:126:13)\r\n    at Server.emit (events.js:214:7)\r\n    at parserOnIncoming (_http_server.js:602:12)\r\n    at HTTPParser.parserOnHeadersComplete (_http_common.js:117:23)\r\n  code: 'EACCES',\r\n  errno: 'EACCES',\r\n  syscall: 'listen',\r\n  address: '/tmp/server0.sock',\r\n  port: -1 }\r\n```\r\n\r\nI tried running the serverless-offline plugin on a different port as well with the same result. My assumption is that both the serverless plugin and the aws-serverless-express modules are creating a server using the same resource and this is why it breaks when the express endpoint is called. I also tried changing the tmp path in index.js file of aws-serverless-express to something different, but didn't work either.\r\n\r\nI would highly appreciate some help. PM me if more info is needed. Thanks!!!"},"comment":{"url":"https://api.github.com/repos/awslabs/aws-serverless-express/issues/comments/364584163","html_url":"https://github.com/awslabs/aws-serverless-express/issues/109#issuecomment-364584163","issue_url":"https://api.github.com/repos/awslabs/aws-serverless-express/issues/109","id":364584163,"user":{"login":"brettstack","id":1882775,"avatar_url":"https://avatars0.githubusercontent.com/u/1882775?v=4","gravatar_id":"","url":"https://api.github.com/users/brettstack","html_url":"https://github.com/brettstack","followers_url":"https://api.github.com/users/brettstack/followers","following_url":"https://api.github.com/users/brettstack/following{/other_user}","gists_url":"https://api.github.com/users/brettstack/gists{/gist_id}","starred_url":"https://api.github.com/users/brettstack/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/brettstack/subscriptions","organizations_url":"https://api.github.com/users/brettstack/orgs","repos_url":"https://api.github.com/users/brettstack/repos","events_url":"https://api.github.com/users/brettstack/events{/privacy}","received_events_url":"https://api.github.com/users/brettstack/received_events","type":"User","site_admin":false},"created_at":"2018-02-09T22:11:43Z","updated_at":"2018-02-09T22:11:43Z","author_association":"CONTRIBUTOR","body":"Fixed in 3.1.1"}}
{"actor":{"display_login":"brettstack"}}