botpress / v12

Botpress OSS – v12
https://v12.botpress.com
GNU Affero General Public License v3.0
83 stars 91 forks source link

Error while running botpress on Heroku #581

Closed chakanish closed 5 years ago

chakanish commented 5 years ago

Getting the following error when running botpress app on Heroku. Botpress running from local

Launcher Error starting Botpress [VError, Fatal error loading module "MODULES_ROOT/.wh.basic-skills": Cannot find module '/botpress/modules/.cache/module__e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855'

Voxelart commented 5 years ago

I have the same error. Using botpress CE 11.3.0 Running ok in localhost, but not running in Heroku. Heroku Logs says:

18:30:46.060 Launcher Error starting Botpress [VError, Fatal error loading module "MODULES_ROOT/.wh.basic-skills": Cannot find module '/botpress/modules/.cache/modulee3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855'] 2019-01-23T18:30:46.062286+00:00 app[web.1]: ----- STACK ----- 2019-01-23T18:30:46.062288+00:00 app[web.1]: VError: Fatal error loading module "MODULES_ROOT/.wh.basic-skills": Cannot find module '/botpress/modules/.cache/module__e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855' 2019-01-23T18:30:46.062290+00:00 app[web.1]: at /snapshot/build-linux/out/bp/bootstrap.js:0:0 2019-01-23T18:30:46.062292+00:00 app[web.1]: at Generator.next () 2019-01-23T18:30:46.062294+00:00 app[web.1]: at fulfilled (/snapshot/build-linux/out/bp/bootstrap.js:0:0) 2019-01-23T18:30:46.062295+00:00 app[web.1]: at tryCatcher (/snapshot/build-linux/node_modules/bluebird/js/release/util.js:16:23) 2019-01-23T18:30:46.062297+00:00 app[web.1]: at Promise.module.exports.Promise._settlePromiseFromHandler (/snapshot/build-linux/node_modules/bluebird/js/release/promise.js:512:31) 2019-01-23T18:30:46.062299+00:00 app[web.1]: at Promise.module.exports.Promise._settlePromise (/snapshot/build-linux/node_modules/bluebird/js/release/promise.js:569:18) 2019-01-23T18:30:46.062300+00:00 app[web.1]: at Promise.module.exports.Promise._settlePromise0 (/snapshot/build-linux/node_modules/bluebird/js/release/promise.js:614:10) 2019-01-23T18:30:46.062302+00:00 app[web.1]: at Promise.module.exports.Promise._settlePromises (/snapshot/build-linux/node_modules/bluebird/js/release/promise.js:694:18) 2019-01-23T18:30:46.062303+00:00 app[web.1]: at _drainQueueStep (/snapshot/build-linux/node_modules/bluebird/js/release/async.js:138:12) 2019-01-23T18:30:46.062305+00:00 app[web.1]: at _drainQueue (/snapshot/build-linux/node_modules/bluebird/js/release/async.js:131:9) 2019-01-23T18:30:46.062307+00:00 app[web.1]: at Async._drainQueues (/snapshot/build-linux/node_modules/bluebird/js/release/async.js:147:5) 2019-01-23T18:30:46.062309+00:00 app[web.1]: at Immediate.Async.drainQueues (/snapshot/build-linux/node_modules/bluebird/js/release/async.js:17:14) 2019-01-23T18:30:46.062310+00:00 app[web.1]: at runCallback (timers.js:696:18) 2019-01-23T18:30:46.062312+00:00 app[web.1]: at tryOnImmediate (timers.js:667:5) 2019-01-23T18:30:46.062313+00:00 app[web.1]: at processImmediate (timers.js:649:5) 2019-01-23T18:30:46.064670+00:00 app[web.1]: 18:30:46.062 Launcher Error starting Botpress [VError, Fatal error loading module "MODULES_ROOT/.wh.builtin": Cannot find module '/botpress/modules/.cache/modulee3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855'] 2019-01-23T18:30:46.064673+00:00 app[web.1]: ----- STACK ----- 2019-01-23T18:30:46.064675+00:00 app[web.1]: VError: Fatal error loading module "MODULES_ROOT/.wh.builtin": Cannot find module '/botpress/modules/.cache/modulee3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855' 2019-01-23T18:30:46.064677+00:00 app[web.1]: at /snapshot/build-linux/out/bp/bootstrap.js:0:0 2019-01-23T18:30:46.064678+00:00 app[web.1]: at Generator.next () 2019-01-23T18:30:46.064680+00:00 app[web.1]: at fulfilled (/snapshot/build-linux/out/bp/bootstrap.js:0:0) 2019-01-23T18:30:46.064682+00:00 app[web.1]: at tryCatcher (/snapshot/build-linux/node_modules/bluebird/js/release/util.js:16:23) 2019-01-23T18:30:46.064684+00:00 app[web.1]: at Promise.module.exports.Promise._settlePromiseFromHandler (/snapshot/build-linux/node_modules/bluebird/js/release/promise.js:512:31) 2019-01-23T18:30:46.064685+00:00 app[web.1]: at Promise.module.exports.Promise._settlePromise (/snapshot/build-linux/node_modules/bluebird/js/release/promise.js:569:18) 2019-01-23T18:30:46.064687+00:00 app[web.1]: at Promise.module.exports.Promise._settlePromise0 (/snapshot/build-linux/node_modules/bluebird/js/release/promise.js:614:10) 2019-01-23T18:30:46.064689+00:00 app[web.1]: at Promise.module.exports.Promise._settlePromises (/snapshot/build-linux/node_modules/bluebird/js/release/promise.js:694:18) 2019-01-23T18:30:46.064690+00:00 app[web.1]: at _drainQueueStep (/snapshot/build-linux/node_modules/bluebird/js/release/async.js:138:12) 2019-01-23T18:30:46.064692+00:00 app[web.1]: at _drainQueue (/snapshot/build-linux/node_modules/bluebird/js/release/async.js:131:9) 2019-01-23T18:30:46.064693+00:00 app[web.1]: at Async._drainQueues (/snapshot/build-linux/node_modules/bluebird/js/release/async.js:147:5) 2019-01-23T18:30:46.064695+00:00 app[web.1]: at Immediate.Async.drainQueues (/snapshot/build-linux/node_modules/bluebird/js/release/async.js:17:14) 2019-01-23T18:30:46.064697+00:00 app[web.1]: at runCallback (timers.js:696:18) 2019-01-23T18:30:46.064698+00:00 app[web.1]: at tryOnImmediate (timers.js:667:5) 2019-01-23T18:30:46.064700+00:00 app[web.1]: at processImmediate (timers.js:649:5) 2019-01-23T18:30:46.067729+00:00 app[web.1]: 18:30:46.065 Launcher Error starting Botpress [VError, Fatal error loading module "MODULES_ROOT/.wh.channel-web": Cannot find module '/botpress/modules/.cache/module__e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855'] 2019-01-23T18:30:46.067733+00:00 app[web.1]: ----- STACK ----- 2019-01-23T18:30:46.067735+00:00 app[web.1]: VError: Fatal error loading module "MODULES_ROOT/.wh.channel-web": Cannot find module '/botpress/modules/.cache/modulee3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855' 2019-01-23T18:30:46.067737+00:00 app[web.1]: at /snapshot/build-linux/out/bp/bootstrap.js:0:0 2019-01-23T18:30:46.067738+00:00 app[web.1]: at Generator.next () 2019-01-23T18:30:46.067740+00:00 app[web.1]: at fulfilled (/snapshot/build-linux/out/bp/bootstrap.js:0:0) 2019-01-23T18:30:46.067742+00:00 app[web.1]: at tryCatcher (/snapshot/build-linux/node_modules/bluebird/js/release/util.js:16:23) 2019-01-23T18:30:46.067743+00:00 app[web.1]: at Promise.module.exports.Promise._settlePromiseFromHandler (/snapshot/build-linux/node_modules/bluebird/js/release/promise.js:512:31) 2019-01-23T18:30:46.067745+00:00 app[web.1]: at Promise.module.exports.Promise._settlePromise (/snapshot/build-linux/node_modules/bluebird/js/release/promise.js:569:18) 2019-01-23T18:30:46.067746+00:00 app[web.1]: at Promise.module.exports.Promise._settlePromise0 (/snapshot/build-linux/node_modules/bluebird/js/release/promise.js:614:10) 2019-01-23T18:30:46.067748+00:00 app[web.1]: at Promise.module.exports.Promise._settlePromises (/snapshot/build-linux/node_modules/bluebird/js/release/promise.js:694:18) 2019-01-23T18:30:46.067749+00:00 app[web.1]: at _drainQueueStep (/snapshot/build-linux/node_modules/bluebird/js/release/async.js:138:12) 2019-01-23T18:30:46.067751+00:00 app[web.1]: at _drainQueue (/snapshot/build-linux/node_modules/bluebird/js/release/async.js:131:9) 2019-01-23T18:30:46.067761+00:00 app[web.1]: at Async._drainQueues (/snapshot/build-linux/node_modules/bluebird/js/release/async.js:147:5) 2019-01-23T18:30:46.067763+00:00 app[web.1]: at Immediate.Async.drainQueues (/snapshot/build-linux/node_modules/bluebird/js/release/async.js:17:14) 2019-01-23T18:30:46.067764+00:00 app[web.1]: at runCallback (timers.js:696:18) 2019-01-23T18:30:46.067766+00:00 app[web.1]: at tryOnImmediate (timers.js:667:5) 2019-01-23T18:30:46.067767+00:00 app[web.1]: at processImmediate (timers.js:649:5) 2019-01-23T18:30:46.070723+00:00 app[web.1]: 18:30:46.068 Launcher Error starting Botpress [VError, Fatal error loading module "MODULES_ROOT/.wh.nlu": Cannot find module '/botpress/modules/.cache/module__e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855']

............................................................

Help Please

allardy commented 5 years ago

@chakanish @Voxelart Which version exactly did you use to deploy on Heroku? (Docker image, or pushing from your local installation?) Can you show us the relevant part of your botpress.config file ?

Voxelart commented 5 years ago

Hi Allardy, thak you so much for your fast response. I don't know what you mean by what version am I using for deploy on Heroku. Do you reffer to the botpress version? In my case, locally I am using botpress CE 11.3.0 ( botpress-ce-v11_3_0-linux-x64 ), I have downladed it from your webpage --> https://s3.amazonaws.com/botpress-binaries/botpress-ce-v11_3_0-linux-x64.zip

This is the content I have in my Dockerfile: FROM botpress/server:ce-v11_3_0 WORKDIR /botpress CMD ["./bp"]

For all this I am using the guide you have in your web for botpress 11.3.0 --> https://botpress.io/docs/deploy/hosting/

The OS I am using is CentOS 7. I have also tried using Linux Mint 19.1 Tessa , but Heroku is giving the same error in both cases.

My Heroku CLI version is --> heroku/7.19.4-beta.2a7fcad linux-x64 node-v11.3.0

I have tried using in my pc the node versions 10.15.0 and 11.7.0 via NVM and same heroku error :(

This is the configuration tha appears in my botpress.config.json file

{ "$schema": "../../botpress.config.schema.json", "httpServer": { "host": "localhost", "port": 3000, "backlog": 0, "bodyLimit": "100kb", "cors": { "enabled": true } }, "database": { "type": "sqlite", "location": "%BOTPRESS_DIR%/data/storage/core.sqlite", "host": "localhost", "port": 5432, "user": "postgres", "password": "", "database": "botpress_test" }, "ghost": { "enabled": false }, "dialog": { "janitorInterval": "10s", "timeoutInterval": "2m", "sessionTimeoutInterval": "30m" }, "logs": { "expiration": "2 weeks", "janitorInterval": "30s" }, "modules": [ { "location": "MODULES_ROOT/analytics", "enabled": true }, { "location": "MODULES_ROOT/basic-skills", "enabled": true }, { "location": "MODULES_ROOT/builtin", "enabled": true }, { "location": "MODULES_ROOT/channel-web", "enabled": true }, { "location": "MODULES_ROOT/nlu", "enabled": true }, { "location": "MODULES_ROOT/qna", "enabled": true } ], "licenseKey": "paste your license key here", "sendUsageStats": true, "dataRetention": { "policies": {} }, "jwtSecret": "~tv9R14XGIf7mAaD31B1XUL4463YfkeSHdEI7tvh" }

At this momment I am using ok botpress 10.5 in heroku. I have deployed it using Git and had no problem. botpress 10.5 runs ok in heroku.

I only have problems deploying botpress 11.3.0 :(

I don know if you need more info... Just let me know! Thank you so much :)

slvnperron commented 5 years ago

@Voxelart can you confirm that your modules/ directory is NOT git versioned and not part of the docker image?

Voxelart commented 5 years ago

Hi @slvnperron I can't confirm you if modules/ is or is NOT git versioned, since this is my first contact with git repositories and heroku ( I am using those because I needed them for running your beutiful program ) Anyways, I have investigated what do you mean by "git versioned" and I found in internet a command that seems to lists the git versioned files (I don't know if this is correct or not !) I found it here: https://stackoverflow.com/questions/16067048/how-to-list-all-not-versioned-files-and-directories-in-a-git-working-copy

This is the result: $ git ls-files -o fatal: Not a git repository (or any parent up to mount point /home) Stopping at filesystem boundary (GIT_DISCOVERY_ACROSS_FILESYSTEM not set).

If it helps, here you have some screenshots of my file directory showing also the hiddent files.

Botpress chatbot route folder --> image

image

image

About Dockers Image.... It's also the first time I use Dockers images and I don't know much about how to use it, so I don't know if modules/ is part of the docker image or not.

For deploying botpress 11 I have used your guide https://botpress.io/docs/deploy/hosting/ and done steap by steap what it say. How can I know if modules/ directory is or NOT is git versioned and not part of the docker image?

Thank you so much for helping me :)

allardy commented 5 years ago

@Voxelart I just tried to deploy that image and i'm getting exactly the same result as you. Weird thing is that I don't get that error using the same image on my local docker instance, and I didn't have that error when I deployed on Heroku in the past month.

We're getting ready to ship 11.4, so we'll make sure that it correctly deploys on Heroku, we'll keep you updated

Voxelart commented 5 years ago

Thank so much @allardy for your update :) I Will be waiting for Botpress 11.4 and hope this time I can have it running in Heroku :+1:

EFF commented 5 years ago

@Voxelart @chakanish just to let you know that 11.4 is out. It should fix this issue, please let me know

Voxelart commented 5 years ago

Hi @EFF I don't know if I am doing somethig whrong, but it still don't work's to me. Since you haven't published botpress 11.4 in your webpage, I have downloaded the zip file from the github repository and I have followed the quick start guide you have published here in git where you tell us to run these shell commands: yarn yarn build yarn start After doing this, botpress runs ok in my local machine as you can see in this screenshot:

image But the problem with herocu in my case continues. These are the steaps I have done for deploying botpress in heroku: -I have created a Dockerfile containing this lines:

FROM botpress/server:v11_4_0
WORKDIR /botpress
CMD ["./bp"]

And them, I have run this shell commands in the botpress folder:

heroku login
heroku container:login
heroku container:push web -app mychatbotapp
heroku container:release web -app mychatbotapp

Doing that, when I try to run botpress in the browser I get an error and error like this: image And the heroku CLI log give me the same error as allways, as you can see in the next image:

image

The OS I am using for this test is Linux Mint 19.1 Tessa 64 bits

If it helps, this is a screenshot of the root botpress 11.4 folder: image

And this is a screenshot of the modules folder: image

If any news about this issue, please, let me know. Thank you so much for your interest in helping us.

EFF commented 5 years ago

@Voxelart thanks for letting me know, we'll look at the issue right away !

allardy commented 5 years ago

@Voxelart The issue is fixed on the master branch. We've found out that Heroku no longer automatically delete files marked as such, so those deleted files were detected incorrectly by BP. That issue wasn't visible when running Docker locally since it handles them differently.

We've found another issue on heroku which prevents you from talking with the bot. We'll release an official docker image when this is fixed, but if you want to test, you can use the docker image 2019-01-30-heroku_test2

We'll keep you updated.

image

Voxelart commented 5 years ago

Hi @allardy I just want to let you know that finally, I was able ok to get botpress running in Heroku by using the Docker image 2019-01-30-heroku_test2 as you suggested. I'm so happy. Thank you so much :)

If someone more is facing the same problem, let me tell you that you only have to point your docker image to use the 2019-01-3 version, and you can do that by writing this in your Dockerfile:

FROM botpress/server:2019-01-30-heroku_test2
WORKDIR /botpress
CMD ["./bp"]

Here you have some screenshots where you can see that now it works ok in Heroku :)

image

image

image

Thank you so much for your interest and support :)

allardy commented 5 years ago

@Voxelart @chakanish Both issues were fixed in the latest release: v11_4_1 . Let us know if you have any other issue !

EFF commented 5 years ago

Closing this, feel free to reopen if you still experience the issue with >= 11.4.1