I am trying to get a simple Kafka consumer up and running on Heroku. I am using Node 8.11 and node-rdkafka. I have it running locally. When I try to run it on Heroku, I get this error:
Error: librdkafka++.so.1: cannot open shared object file: No such file or
directory
at Object.Module._extensions..node (module.js:681:18)
at Module.load (module.js:565:32)
at tryModuleLoad (module.js:505:12)
at Function.Module._load (module.js:497:3)
at Module.require (module.js:596:17)
at require (internal/module.js:11:18)
at bindings (/app/node_modules/bindings/bindings.js:81:44)
at Object.<anonymous> (/app/node_modules/node-rdkafka/librdkafka.js:10:32)
at Module._compile (module.js:652:30)
at Object.Module._extensions..js (module.js:663:10)
I know the library is a wrapper for librdkafka and it looks like it just can't find it. According to the list of things preinstalled on Heroku Ubuntu instance, it looks like librdkafka-dev and librdkafka1 are installed. I don't know how to use those, or if something else is going on.
You have to use the Confluent librdkafka package.
Add this to your Aptfile:
:repo:deb [arch=amd64] http://packages.confluent.io/deb/4.0 stable main
Still having issues after doing this, but they are different issues and it looks like I'm closer.
Related
I install node.js with pm2, all install fine but when i try to do pm2 monit give me this error.
$ pm2 monit
/home/node/.nvm/versions/node/v8.11.3/lib/node_modules/pm2/node_modules/fast-printf/dist/src/tokenize.js:4
const TokenRule = /(?:%(?<flag>([+0-]|-\+))?(?<width>\d+)?(?<position>\d+\$)?(?<precision>\.\d+)?(?<conversion>[%BCESb-iosux]))|(\\%)/g;
^
SyntaxError: Invalid regular expression: /(?:%(?<flag>([+0-]|-\+))?(?<width>\d+)?(?<position>\d+\$)?(?<precision>\.\d+)?(?<conversion>[%BCESb-iosux]))|(\\%)/: Invalid group
at Object.<anonymous> (/home/node/.nvm/versions/node/v8.11.3/lib/node_modules/pm2/node_modules/fast-printf/dist/src/tokenize.js:4:19)
at Module._compile (module.js:652:30)
at Object.Module._extensions..js (module.js:663:10)
at Module.load (module.js:565:32)
at tryModuleLoad (module.js:505:12)
at Function.Module._load (module.js:497:3)
at Module.require (module.js:596:17)
at require (internal/module.js:11:18)
at Object.<anonymous> (/home/node/.nvm/versions/node/v8.11.3/lib/node_modules/pm2/node_modules/fast-printf/dist/src/createPrintf.js:5:20)
at Module._compile (module.js:652:30)
I tried servers nodejs version and always give me this error.
If you paste your regular expression into a regex sandbox, like this one:
https://regex101.com/r/GkwWH2/1
You'll see that it doesn't show any syntax errors.
That would make me suspect that you're running a back-level version of Node JS. And in fact, if you look at your stack trace, you see that you are running Node 8.11.3
at Object.<anonymous> (/home/node/.nvm/versions/node/v8.11.3/lib/node_modules/pm2/node_modules/fas
That regular expression is using features (such as named capture groups) that did not come into Node.js until Node v10.*.
I suggest you update to the latest LTS version of Node, version 14.*: from your stack trace it would appear that you're using NVM, so it should be a simple matter of
sudo nvm install lts/fermium
should do it.
I want to make a nodejs application that uses the AWS SDK. However, it only really needs to use S3, and I want the application to have a small filesize.
AWS has a custom sdk builder which should make a custom SDK with only the required packages. Unfortunately, this doesn't work, even when I select all of the services. How do I make a custom SDK that works with node?
I've tried using the npm install aws-sdk, and that works, but it's 40MB. I've also tried selecting all of the services in the service builder (only 3MB), but that doesn't work.
It always gives an error at this line:
var aws = require("./aws-sdk-2.462.0.min.js");
ReferenceError: AWS is not defined
at Object.<anonymous> (/home/cwaugh/workspaces/meta-lambda/aws-sdk-2.462.0.min.js:7:30180)
at Module._compile (module.js:652:30)
at Object.Module._extensions..js (module.js:663:10)
at Module.load (module.js:565:32)
at tryModuleLoad (module.js:505:12)
at Function.Module._load (module.js:497:3)
at Module.require (module.js:596:17)
at require (internal/module.js:11:18)
at Object.<anonymous> (/home/cwaugh/workspaces/meta-lambda/handler.js:5:11)
at Module._compile (module.js:652:30)
at Object.Module._extensions..js (module.js:663:10)
at Module.load (module.js:565:32)
at tryModuleLoad (module.js:505:12)
at Function.Module._load (module.js:497:3)
at Module.require (module.js:596:17)
at require (internal/module.js:11:18)
That's the browser SDK. For Node you can use this module which only provides an S3 Client. That page has a clear example showing how to call putObject using this custom SDK.
There's many different individual modules for a variety of AWS services. You can find more information here.
This is now possible with AWS SDK for JavaScript v3
You can install only the required packages as follows :
npm install #aws-sdk/client-s3
Use them as :
const {S3} = require('#aws-sdk/client-s3');
I'm tired of this error! This is Serverless app with Lambda in AWS. Locally it works perfectly. Testing locally didn't work for load of other reasons. I'm testing in staging. Yet I'm getting this error:
Unable to import module 'src/engine/handler': Error
at Function.Module._resolveFilename (module.js:469:15)
at Function.Module._load (module.js:417:25)
at Module.require (module.js:497:17)
at require (internal/module.js:20:19)
at Object.<anonymous>(/var/task/src/engine/controllers/image.js:43:12)
at Module._compile (module.js:570:32)
at Object.Module._extensions..js (module.js:579:10)
at Module.load (module.js:487:32)
at tryModuleLoad (module.js:446:12)
at Function.Module._load (module.js:438:3)
I followed all the steps advised elsewhere including: moving all dependencies to dependencies (out of dev), installing serverless and all. I'm using Node 6.10.3 and TypeScript 3.1. Can you help?
If you're trying host your nodejs projects which has so many dependencies not related to aws services inside, you better zip your projects in S3 first then import lambda from S3.
I have installed ghost blog on Openshift and created local copy to make some changes. I added new theme and deployed it back to openshift. Its working fine but I am not able to run this blog on my local machine.
If I run NPM start, I am getting following error:
> openshift-ghost-quickstart# start C:\Users\darklord\OneDrive\Business\mean
> node index
Unhandled rejection Error: Cannot find module 'C:\Users\darklord\OneDrive\Business\mean\node_modules\ghost\node_modules\sqlite3\lib\binding\node-v47-win32-x64\node_sqlite3.node'
at Function.Module._resolveFilename (module.js:339:15)
at Function.Module._load (module.js:290:25)
at Module.require (module.js:367:17)
at require (internal/module.js:16:19)
at Object.<anonymous> (C:\Users\darklord\OneDrive\Business\mean\node_modules\ghost\node_modules\sqlite3\lib\sqlite3.js:4:15)
at Module._compile (module.js:413:34)
at Object.Module._extensions..js (module.js:422:10)
at Module.load (module.js:357:32)
at Function.Module._load (module.js:314:12)
at Module.require (module.js:367:17)
at require (internal/module.js:16:19)
at Client_SQLite3.initDriver (C:\Users\darklord\OneDrive\Business\mean\node_modules\ghost\node_modules\knex\lib\dialects\sqlite3\index.js:41:24)
at new Client_SQLite3 (C:\Users\darklord\OneDrive\Business\mean\node_modules\ghost\node_modules\knex\lib\dialects\sqlite3\index.js:15:10)
at Knex.initialize (C:\Users\darklord\OneDrive\Business\mean\node_modules\ghost\node_modules\knex\knex.js:109:15)
at Knex (C:\Users\darklord\OneDrive\Business\mean\node_modules\ghost\node_modules\knex\knex.js:13:26)
at ConfigManager.set (C:\Users\darklord\OneDrive\Business\mean\node_modules\ghost\core\server\config\index.js:156:24)
at ConfigManager.init (C:\Users\darklord\OneDrive\Business\mean\node_modules\ghost\core\server\config\index.js:79:10)
at C:\Users\darklord\OneDrive\Business\mean\node_modules\ghost\core\server\config\index.js:273:30
at tryCatcher (C:\Users\darklord\OneDrive\Business\mean\node_modules\ghost\node_modules\bluebird\js\main\util.js:26:23)
at Promise._settlePromiseFromHandler (C:\Users\darklord\OneDrive\Business\mean\node_modules\ghost\node_modules\bluebird\js\main\promise.js:507:31)
at Promise._settlePromiseAt (C:\Users\darklord\OneDrive\Business\mean\node_modules\ghost\node_modules\bluebird\js\main\promise.js:581:18)
at Promise._settlePromises (C:\Users\darklord\OneDrive\Business\mean\node_modules\ghost\node_modules\bluebird\js\main\promise.js:697:14)
I though that this errpr has something to do with sqlite3 so I have uninstalled and installed it back but still same error.
Can someone let me know what mistake I am going ?
In case other people are running into this issue.
You are probably running a different node.js version on your local machine.
You could check manually in the {gostblog}\node_modules\ghost\node_modules\sqlite3\lib\binding\ folder if you have a different version than the node-v47-win32-x64 he is asking for.
Just reinstall the Ghost dependencies on your local machine to get it running.
I am trying to deploy a node app on Linode (Ubuntu 12.04) while following this guide from Node Knockout: http://blog.nodeknockout.com/post/9300619913/countdown-to-ko-14-deploying-your-node-js-app-to
I have no problems running the server as root, but when trying to start the server as the "deploy" user using sudo start node, I get this error:
/home/deploy/app/source/node_modules/bcrypt/node_modules/bindings/bindings.js:79
throw e
^
Error: Module version mismatch. Expected 11, got 1.
at Module.load (module.js:356:32)
at Function.Module._load (module.js:312:12)
at Module.require (module.js:364:17)
at require (module.js:380:17)
at bindings (/home/deploy/app/source/node_modules/bcrypt/node_modules/bindings/$
at Object.<anonymous> (/home/deploy/app/source/node_modules/bcrypt/bcrypt.js:1:$
at Module._compile (module.js:456:26)
at Object.Module._extensions..js (module.js:474:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:312:12)
I have tried recompiling bcrypt using make clean then make since I thought my module version was incompatible with my version of node (v0.8.18), but that does not seem to be the case since I can start the server as root with no problem. I feel as though the problem lies in how I set up the deploy user, but I am not sure how to proceed.