{"action":"created","issue":{"url":"https://api.github.com/repos/serverless-heaven/serverless-webpack/issues/230","repository_url":"https://api.github.com/repos/serverless-heaven/serverless-webpack","labels_url":"https://api.github.com/repos/serverless-heaven/serverless-webpack/issues/230/labels{/name}","comments_url":"https://api.github.com/repos/serverless-heaven/serverless-webpack/issues/230/comments","events_url":"https://api.github.com/repos/serverless-heaven/serverless-webpack/issues/230/events","html_url":"https://github.com/serverless-heaven/serverless-webpack/issues/230","id":258951262,"number":230,"title":"Unable to import module 'handler': Error revisited","user":{"login":"two7sclash","id":1204547,"avatar_url":"https://avatars1.githubusercontent.com/u/1204547?v=4","gravatar_id":"","url":"https://api.github.com/users/two7sclash","html_url":"https://github.com/two7sclash","followers_url":"https://api.github.com/users/two7sclash/followers","following_url":"https://api.github.com/users/two7sclash/following{/other_user}","gists_url":"https://api.github.com/users/two7sclash/gists{/gist_id}","starred_url":"https://api.github.com/users/two7sclash/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/two7sclash/subscriptions","organizations_url":"https://api.github.com/users/two7sclash/orgs","repos_url":"https://api.github.com/users/two7sclash/repos","events_url":"https://api.github.com/users/two7sclash/events{/privacy}","received_events_url":"https://api.github.com/users/two7sclash/received_events","type":"User","site_admin":false},"labels":[{"id":698852254,"url":"https://api.github.com/repos/serverless-heaven/serverless-webpack/labels/issue/under-investigation","name":"issue/under-investigation","color":"e99695","default":false}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":14,"created_at":"2017-09-19T20:20:46Z","updated_at":"2017-09-21T09:58:12Z","closed_at":null,"author_association":"NONE","body":"This is a Bug Report\r\n\r\n## Description\r\n\r\nFor bug reports:\r\n* What went wrong?\r\nI get `Unable to import module 'handler': Error` when visiting my AWS endpoint \r\n* What did you expect should have happened?\r\nEverything works fine locally. Expecting same results.\r\n* What was the config you used?\r\n\r\n**serverless.yml**:\r\n```service: alerts\r\n\r\ncustom:\r\n  webpackIncludeModules: true;\r\n    \r\n# package:\r\n#  individually: true\r\n\r\nprovider:\r\n  name: aws\r\n  runtime: nodejs6.10\r\n\r\n# you can overwrite defaults here\r\n  stage: dev\r\n  region: us-east-1\r\n\r\nfunctions:\r\n  alerts:\r\n    handler: handler.alerts\r\n    events:\r\n      - http: ANY alerts\r\n      - cors: true    \r\n\r\nplugins:\r\n  - serverless-webpack\r\n  - serverless-offline\r\n```\r\n\r\n**webpack.config.js**\r\n```const path = require('path');\r\nconst slsw = require('serverless-webpack');\r\nconst nodeExternals = require('webpack-node-externals');\r\n\r\nmodule.exports = {\r\n  entry: slsw.lib.entries,\r\n  externals: [nodeExternals()], // in order to ignore all modules in node_modules folder\r\n  target: 'node',\r\n  module: {\r\n    loaders: [\r\n      {\r\n        test: /\\.js$/,\r\n        exclude: /node_modules/, // in order to ignore built-in modules like path, fs, etc.\r\n        loaders: ['babel-loader'],\r\n        include: __dirname,\r\n      },\r\n    ],\r\n  },\r\n  output: {\r\n    libraryTarget: 'commonjs',\r\n    path: path.join(__dirname, '.webpack'),\r\n    filename: '[name].js',\r\n  },\r\n};\r\n```\r\n**package.json**\r\n```{\r\n  \"name\": \"alerts\",\r\n  \"version\": \"1.0.0\",\r\n  \"description\": \"\",\r\n  \"main\": \"handler.js\",\r\n  \"scripts\": {\r\n    \"test\": \"mocha handler.test.js\",\r\n    \"debug:offline\": \"SLS_DEBUG=* sls offline start\",\r\n    \"debug:deploy\": \"SLS_DEBUG=* sls deploy --verbose\",\r\n    \"debug\": \"SLS_DEBUG=* sls deploy --verbose && nodemon sls offline start\",\r\n    \"invoke\": \"serverless invoke local --function alerts\",\r\n    \"start\": \"serverless offline start\",\r\n    \"deploy\": \"sls deploy -f alerts\",\r\n    \"curl:local\": \"curl http://localhost:3000/alerts -i --header 'Content-Type: application/vnd.api+json' --header 'Accept: application/vnd.api+json'\",\r\n    \"curl:local:paged\": \"curl http://localhost:3000/alerts -i -G -d page[offset]=2 -d page[limit]=10 --header 'Content-Type: application/vnd.api+json' --header 'Accept: application/vnd.api+json'\",\r\n    \"git:push\": \"git push https://git-codecommit.us-east-1.amazonaws.com/v1/repos/alerts --all\",\r\n    \"mockAPI\": \"http-server -p 1980\",\r\n    \"ngrok:start\": \"nodemon --inspect ./ngrok/request.js --exec babel-node\",\r\n    \"ngrok:connect\": \"nodemon ./ngrok/connect.js --exec babel-node\",\r\n    \"ngrok\": \"ngrok http 3000\"\r\n  },\r\n  \"author\": \"James Fishwick\",\r\n  \"license\": \"ISC\",\r\n  \"engines\": {\r\n    \"node\": \"6.10.3\"\r\n  },\r\n  \"dependencies\": {\r\n    \"babel-runtime\": \"6.26.0\",\r\n    \"bluebird\": \"3.5.0\",\r\n    \"dotenv\": \"4.0.0\",\r\n    \"elasticsearch\": \"13.3.1\",\r\n    \"http-aws-es\": \"3.1.0\",\r\n    \"json-api-serializer\": \"1.9.1\",\r\n    \"ramda\": \"0.24.1\",\r\n    \"request\": \"2.81.0\",\r\n    \"request-promise\": \"4.2.1\",\r\n    \"uuid\": \"3.1.0\"\r\n  },\r\n  \"devDependencies\": {\r\n    \"aws-sdk\": \"2.118.0\",\r\n    \"babel-cli\": \"6.26.0\",\r\n    \"babel-core\": \"6.26.0\",\r\n    \"babel-eslint\": \"7.2.3\",\r\n    \"babel-loader\": \"7.1.2\",\r\n    \"babel-plugin-ramda\": \"1.4.3\",\r\n    \"babel-plugin-transform-object-rest-spread\": \"6.26.0\",\r\n    \"babel-plugin-transform-runtime\": \"6.23.0\",\r\n    \"babel-preset-env\": \"1.6.0\",\r\n    \"chai\": \"4.1.2\",\r\n    \"eslint\": \"4.7.1\",\r\n    \"eslint-config-airbnb-base\": \"12.0.0\",\r\n    \"eslint-plugin-async-await\": \"0.0.0\",\r\n    \"eslint-plugin-babel\": \"4.1.2\",\r\n    \"eslint-plugin-chai-expect\": \"1.1.1\",\r\n    \"eslint-plugin-import\": \"2.7.0\",\r\n    \"eslint-plugin-mocha\": \"4.11.0\",\r\n    \"eslint-plugin-node\": \"5.1.1\",\r\n    \"eslint-plugin-prefer-object-spread\": \"1.2.1\",\r\n    \"http-server\": \"0.10.0\",\r\n    \"mocha\": \"3.5.3\",\r\n    \"ngrok\": \"2.2.22\",\r\n    \"nodemon\": \"1.12.1\",\r\n    \"npm-run-script\": \"0.0.4\",\r\n    \"pre-commit\": \"1.2.2\",\r\n    \"serverless\": \"1.22.0\",\r\n    \"serverless-offline\": \"3.16.0\",\r\n    \"serverless-webpack\": \"^3.0.0-rc.1\",\r\n    \"webpack\": \"3.6.0\",\r\n    \"webpack-node-externals\": \"1.6.0\"\r\n  }\r\n}\r\n```\r\n\r\n* What stacktrace or error message from your provider did you see?\r\n```Serverless: Bundling with Webpack...\r\nbabel-preset-env: `DEBUG` option\r\n\r\nUsing targets:\r\n{\r\n  \"node\": \"6.10\"\r\n}\r\n\r\nModules transform: commonjs\r\n\r\nUsing plugins:\r\n  transform-exponentiation-operator {\"node\":\"6.10\"}\r\n  transform-async-to-generator {\"node\":\"6.10\"}\r\n  syntax-trailing-function-commas {\"node\":\"6.10\"}\r\nTime: 864ms\r\n     Asset     Size  Chunks             Chunk Names\r\nhandler.js  13.3 kB       0  [emitted]  handler\r\n   [0] external \"dotenv\" 42 bytes {0} [not cacheable]\r\n   [1] ./handler.js 1.43 kB {0} [built]\r\n   [2] ./main.js 6.96 kB {0} [built]\r\n   [3] external \"babel-runtime/core-js/json/stringify\" 42 bytes {0} [not cacheable]\r\n   [4] external \"babel-runtime/helpers/extends\" 42 bytes {0} [not cacheable]\r\n   [5] external \"babel-runtime/helpers/asyncToGenerator\" 42 bytes {0} [not cacheable]\r\n   [6] external \"url\" 42 bytes {0} [not cacheable]\r\n   [7] external \"bluebird\" 42 bytes {0} [not cacheable]\r\n   [8] external \"request-promise\" 42 bytes {0} [not cacheable]\r\n   [9] external \"uuid/v5\" 42 bytes {0} [not cacheable]\r\n  [10] ./serializer.js 724 bytes {0} [built]\r\n  [11] external \"json-api-serializer\" 42 bytes {0} [not cacheable]\r\n  [12] ./pplog.js 409 bytes {0} [built]\r\n  [13] external \"util\" 42 bytes {0} [not cacheable]\r\nServerless: Fetch dependency graph from /Users/jamesfishwick/Documents/alerts/package.json\r\nServerless: Packing external modules: dotenv@4.0.0, babel-runtime@6.26.0, bluebird@3.5.0, request-promise@4.2.1, uuid@3.1.0, json-api-serializer@1.9.1\r\nServerless: Package took [4104 ms]\r\nServerless: Copy modules: /Users/jamesfishwick/Documents/alerts/.webpack/service [1921 ms]\r\nServerless: Prune: /Users/jamesfishwick/Documents/alerts/.webpack/service [1725 ms]\r\nServerless: Zip service: /Users/jamesfishwick/Documents/alerts/.webpack/service [3625 ms]\r\nServerless: Packaging service...\r\nServerless: Remove /Users/jamesfishwick/Documents/alerts/.webpack\r\nServerless: Invoke aws:package:finalize\r\nServerless: Invoke aws:common:moveArtifactsToPackage\r\nServerless: Invoke aws:common:validate\r\nServerless: Invoke aws:deploy:deploy\r\nServerless: Uploading CloudFormation file to S3...\r\nServerless: Uploading artifacts...\r\nServerless: Validating template...\r\nServerless: Updating Stack...\r\nServerless: Checking Stack update progress...\r\nCloudFormation - UPDATE_IN_PROGRESS - AWS::CloudFormation::Stack - alerts-dev\r\nCloudFormation - UPDATE_IN_PROGRESS - AWS::Lambda::Function - AlertsLambdaFunction\r\nCloudFormation - UPDATE_COMPLETE - AWS::Lambda::Function - AlertsLambdaFunction\r\nCloudFormation - CREATE_IN_PROGRESS - AWS::ApiGateway::Deployment - ApiGatewayDeployment1505851381038\r\nCloudFormation - CREATE_IN_PROGRESS - AWS::ApiGateway::Deployment - ApiGatewayDeployment1505851381038\r\nCloudFormation - CREATE_COMPLETE - AWS::ApiGateway::Deployment - ApiGatewayDeployment1505851381038\r\nCloudFormation - UPDATE_COMPLETE_CLEANUP_IN_PROGRESS - AWS::CloudFormation::Stack - alerts-dev\r\nCloudFormation - DELETE_IN_PROGRESS - AWS::ApiGateway::Deployment - ApiGatewayDeployment1505851297621\r\nCloudFormation - DELETE_COMPLETE - AWS::ApiGateway::Deployment - ApiGatewayDeployment1505851297621\r\nCloudFormation - UPDATE_COMPLETE - AWS::CloudFormation::Stack - alerts-dev\r\nServerless: Stack update finished...\r\nServerless: Invoke aws:info\r\nService Information\r\nservice: alerts\r\nstage: dev\r\nregion: us-east-1\r\nstack: alerts-dev\r\napi keys:\r\n  None\r\nendpoints:\r\n  ANY - https://xxx.execute-api.us-east-1.amazonaws.com/dev/alerts\r\nfunctions:\r\n  alerts: alerts-dev-alerts\r\n\r\nStack Outputs\r\nAlertsLambdaFunctionQualifiedArn: arn:aws:lambda:us-east-1:xxx:function:alerts-dev-alerts:6\r\nServiceEndpoint: https://xxx.execute-api.us-east-1.amazonaws.com/dev\r\nServerlessDeploymentBucketName: alerts-dev-serverlessdeploymentbucket-18jzstz1xn4qa\r\n\r\nServerless: Publish service to Serverless Platform...\r\nService successfully published! Your service details are available at:\r\nhttps://platform.serverless.com/services/two7sclash/alerts\r\nServerless: Invoke aws:deploy:finalize\r\nServerless: Removing old service versions...\r\n```\r\n\r\nthen:\r\n\r\n`curl https://xxx.execute-api.us-east-1.amazonaws.com/dev/alerts`  gives `{\"message\": \"Internal server error\"}`\r\n\r\n**Stack trace is:**\r\n```\r\nUnable to import module 'handler': Error\r\nat Function.Module._resolveFilename (module.js:469:15)\r\nat Function.Module._load (module.js:417:25)\r\nat Module.require (module.js:497:17)\r\nat require (internal/module.js:20:19)\r\nat /var/task/node_modules/request-promise/lib/rp.js:11:16\r\nat module.exports (/var/task/node_modules/stealthy-require/lib/index.js:62:23)\r\nat Object.<anonymous> (/var/task/node_modules/request-promise/lib/rp.js:10:19)\r\nat Module._compile (module.js:570:32)\r\nat Object.Module._extensions..js (module.js:579:10)\r\nat Module.load (module.js:487:32)\r\nat tryModuleLoad (module.js:446:12)\r\nat Function.Module._load (module.js:438:3)\r\nat Module.require (module.js:497:17)\r\nat require (internal/module.js:20:19)\r\nat Object.<anonymous> (/var/task/handler.js:370:18)\r\nat __webpack_require__ (/var/task/handler.js:20:30)\r\nat Object.<anonymous> (/var/task/handler.js:162:17)\r\nat __webpack_require__ (/var/task/handler.js:20:30)\r\nat Object.<anonymous> (/var/task/handler.js:80:14)\r\nat __webpack_require__ (/var/task/handler.js:20:30)\r\nat /var/task/handler.js:63:18\r\nat Object.<anonymous> (/var/task/handler.js:66:10)\r\n```\r\n\r\nSimilar or dependent issue(s):\r\n*#43\r\n\r\n## Additional Data\r\n\r\n* ***Serverless-Webpack Version you're using***: ^3.0.0-rc.1\r\n* ***Webpack version you're using***: 3.6.0\r\n* ***Serverless Framework Version you're using***: 1.22.0\r\n* ***Operating System***: macOS Sierra 10.12.6 16G29 x86_64\r\n\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/serverless-heaven/serverless-webpack/issues/comments/331110595","html_url":"https://github.com/serverless-heaven/serverless-webpack/issues/230#issuecomment-331110595","issue_url":"https://api.github.com/repos/serverless-heaven/serverless-webpack/issues/230","id":331110595,"user":{"login":"HyperBrain","id":5524702,"avatar_url":"https://avatars3.githubusercontent.com/u/5524702?v=4","gravatar_id":"","url":"https://api.github.com/users/HyperBrain","html_url":"https://github.com/HyperBrain","followers_url":"https://api.github.com/users/HyperBrain/followers","following_url":"https://api.github.com/users/HyperBrain/following{/other_user}","gists_url":"https://api.github.com/users/HyperBrain/gists{/gist_id}","starred_url":"https://api.github.com/users/HyperBrain/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/HyperBrain/subscriptions","organizations_url":"https://api.github.com/users/HyperBrain/orgs","repos_url":"https://api.github.com/users/HyperBrain/repos","events_url":"https://api.github.com/users/HyperBrain/events{/privacy}","received_events_url":"https://api.github.com/users/HyperBrain/received_events","type":"User","site_admin":false},"created_at":"2017-09-21T09:58:12Z","updated_at":"2017-09-21T09:58:12Z","author_association":"OWNER","body":"Just cleared the flags as the peer dependency require is solved by #231 .\r\nThe crash in Url.parse() has to be investigated and analyzed."}}
{"actor":{"display_login":"HyperBrain"}}