iopipe / serverless-iopipe-layers

Please migrate to the equivalent New Relic Serverless plugin: serverless-newrelic-lambda-layers
https://github.com/iopipe/serverless-newrelic-lambda-layers
Apache License 2.0
14 stars 8 forks source link

IOpipe layer not being added when installed with webpack plugin #41

Open austinhuminski opened 5 years ago

austinhuminski commented 5 years ago

Install not working when using the example in this repo with serverless-webpack. No layers or IOpipe environment variables get added to the function. When invoking, the "No Plugins" error message returns denoting that it could not find the iopipe wrapper in the context of the invocation

Austins-MacBook-Pro:serverless-webpack austinhuminski$ sls invoke -f handler
{
    "errorType": "Error",
    "errorMessage": "No plugins",
    "trace": [
        "Error: No plugins",
        "    at Runtime.e.exports.handler (/var/task/handler.js:1:1037)",
        "    at Runtime.handleOnce (/var/runtime/Runtime.js:66:25)",
        "    at process._tickCallback (internal/process/next_tick.js:68:7)"
    ]
}

Tried to alter webpack config and manually add in iopipe-wrapper.js files:

iopipe-handler.js

module.exports = require('@iopipe/iopipe');

webpack.config.js

const slsw = require("serverless-webpack");
const CopyWebpackPlugin = require('copy-webpack-plugin');

module.exports = {
  entry: slsw.lib.entries,
  target: "node",
  plugins: [
        new CopyWebpackPlugin([
            {
                from: './iopipe-wrapper.js',
                to: './',
            },
        ]),
    ],
};

Versions

"dependencies": {
  "serverless": "^1.51.0",
  "serverless-iopipe-layers": "^0.4.0",
  "serverless-webpack": "^5.2.0",
  "webpack": "^4.39.3"
},
"devDependencies": {
  "copy-webpack-plugin": "^5.0.4"
}