MySiteApp / node-safari-push-notifications

Helper methods for generating resources required by Apple's Safari Push Notifications.
MIT License
23 stars 14 forks source link

bindings and lambda #14

Closed ghost closed 7 years ago

ghost commented 7 years ago

Hello @kobim ,

Thank you for this module.

I develop and bundle my project on macOS and upload it to lambda. Two problems:

  1. bindings (?) generated for macOS, so when lambda tries to run the module, there's a native error
  2. I tried bundling my project on linux as a test, and the problem remained (see below)
module initialization error: Error
at Error (native)
at Object.Module._extensions..node (module.js:597:18)
at Module.load (module.js:487:32)
at tryModuleLoad (module.js:446:12)
at Function.Module._load (module.js:438:3)
at Module.require (module.js:497:17)
at require (internal/module.js:20:19)
at bindings (/var/task/node_modules/bindings/bindings.js:81:44)
at Object.<anonymous> (/var/task/node_modules/safari-push-notifications/src/index.js:4:30)

I am not really familiar with bindings or gyp; how can I pre-package dependencies for my target platform and load those at runtime, instead of the existing way?

kobim commented 7 years ago

Hi @vbresults , I didn't have a chance to try and deploy this (or any other library with bindings) on AWS Lambda, but a quick Google search lead me to https://github.com/myrmex-org/docker-lambda-packager which is giving you the option to build a node_modules folder with bindings that can run on Lambda. Would you care to try that?

ghost commented 7 years ago

@kobim I tried that and it worked, thank you. That said, this feels a bit complex. Is it possible to implement the signing with this so there's no need for native libraries?

kobim commented 7 years ago

These are great news! You are more than welcome to submit a PR without any native libraries, and I'll gladly merge and release a version with it.

ghost commented 7 years ago

@kobim I tried but since I'm not familiar with the command it would not generate the signature properly. It would always say signature verification failed and I tried every combination of certs possible.