bustle / wool

Lambda Wrapper
3 stars 1 forks source link

How to use with shep? #17

Open winglian opened 7 years ago

winglian commented 7 years ago

I've tried simply the basic example, and when deployed with shep, I get the error below. Am I missing anything obvious?

import { asyncHandler } from 'wooljs'

export const handler = asyncHandler(
  async (event) => {
    console.log(event);
    return 'success';
  }
);
module initialization error: Error
at Error (native)
at Object.fs.openSync (fs.js:640:18)
at Object.fs.readFileSync (fs.js:508:33)
at /var/task/index.js:17598:17
at Object.<anonymous> (/var/task/index.js:17600:2)
at Object.<anonymous> (/var/task/index.js:17956:30)
at __webpack_require__ (/var/task/index.js:21:30)
at Object.<anonymous> (/var/task/index.js:17551:18)
at __webpack_require__ (/var/task/index.js:21:30)
at Object.module.exports.module.exports.id (/var/task/index.js:39430:17)
zfoster commented 7 years ago

I don't think you're missing anything - i suspect there's a bug right now. I'll give it a look in the morning

winglian commented 7 years ago

@zfoster It looks like it is related to Airbrake from wooljs being included with webpack. It seems airbrake wants to read out the package.json file which shep doesn't ship or need.

Airbrake.PACKAGE = function () {
  var json = fs.readFileSync(__dirname + '/../package.json', 'utf8');
  return JSON.parse(json);
}();

which is referenced in https://github.com/airbrake/node-airbrake/blob/master/lib/airbrake.js#L53

zfoster commented 7 years ago

Hey winglian - sorry for the radio silence. this project has been sidelined for awhile. I'll eventually get around to working through it, but if you're interested in removing airbrake in a PR, I'll merge that right away.