У меня есть веб-приложение для сбора всех твитов, относящихся к определенному списку c ключевых слов, с использованием API потока твиттера, оно написано на Javascript ES6 и передано Babel в ES5. Это сервер узла, который использует Express. js для маршрутизации и logi c, Mon goose для проверки и MongoDB в качестве связанной базы данных.
Проект работал локально как шарм и поток остался без сбоев, но как только я развернул его на Heroku, сборка завершилась неудачно через 10 минут, поэтому я провел некоторое исследование / поиск, и порекомендовал обновить версию узла и увеличить размер памяти, что я и сделал, но снова процесс сборки не удался, однако на этот раз он продолжал работать около 20 минут, а затем разбился.
обновление с бесплатного dyno heroku до Hobby может решить проблему, даже если у них такой же размер RAM? или это не связано?
heroku config:set NODE_OPTIONS="--max_old_space_size=2560" -a appname
Кто-нибудь может помочь мне выкопать бревно здания?
-----> Node.js app detected
-----> Creating runtime environment
NPM_CONFIG_LOGLEVEL=error
NODE_OPTIONS=--max_old_space_size=2560
NODE_ENV=production
NODE_MODULES_CACHE=true
NODE_VERBOSE=false
-----> Installing binaries
engines.node (package.json): unspecified
engines.npm (package.json): unspecified (use default)
engines.yarn (package.json): unspecified (use default)
Resolving node version 12.x...
Downloading and installing node 12.16.3...
Using default npm version: 6.14.4
Resolving yarn version 1.x...
Downloading and installing yarn (1.22.4)...
Installed yarn 1.22.4
-----> Restoring cache
- yarn cache
-----> Installing dependencies
Installing node modules (yarn.lock)
yarn install v1.22.4
[1/4] Resolving packages...
[2/4] Fetching packages...
info fsevents@1.2.12: The platform "linux" is incompatible with this module.
info "fsevents@1.2.12" is an optional dependency and failed compatibility check. Excluding it from installation.
[3/4] Linking dependencies...
[4/4] Building fresh packages...
Done in 15.45s.
-----> Build
Detected both "build" and "heroku-postbuild" scripts
Running heroku-postbuild (yarn)
yarn run v1.22.4
$ yarn start
$ yarn build && node dist/app.js
$ babel src -d dist
Successfully compiled 6 files with Babel.
Twitter app is ready on 8081
FATAL ERROR: Ineffective mark-compacts near heap limit Allocation failed - JavaScript heap out of memory
Writing Node.js report to file: report.20200505.013633.1154.0.001.json
<--- Last few GCs --->
[1154:0x49ee9e0] 1411352 ms: Scavenge 2541.9 (2563.1) -> 2541.0 (2563.1) MB, 7.5 / 0.0 ms (average mu = 0.094, current mu = 0.128) allocation failure
[1154:0x49ee9e0] 1411368 ms: Scavenge 2542.0 (2563.1) -> 2541.1 (2563.1) MB, 10.3 / 0.0 ms (average mu = 0.094, current mu = 0.128) allocation failure
[1154:0x49ee9e0] 1411390 ms: Scavenge 2542.0 (2563.1) -> 2541.2 (2563.3) MB, 8.9 / 0.0 ms (average mu = 0.094, current mu = 0.128) allocation failure
<--- JS stacktrace --->
==== JS stack trace =========================================
0: ExitFrame [pc: 0x13c5b79]
1: StubFrame [pc: 0x13a64db]
Security context: 0x3f50d33008d1 <JSObject>
2: split [0x3f50d330f141](this=0x1c69201edd79 <String[#16]: retweeted_status>,0x120848912271 <JSRegExp <String[#2]: \.>>)
3: /* anonymous */ [0x2e5de3c38d59] [/tmp/build_b9f5f73838745ab373e3ebe59b8cb65f/node_modules/mongoose/lib/schema.js:~618] [pc=0x342a877daeec](this=0x363344441d49 <Schema map = 0x12c3764c509>,0x1c69201e...
Node.js report completed
1: 0xa09830 node::Abort() [/tmp/build_b9f5f73838745ab373e3ebe59b8cb65f/.heroku/node/bin/node]
2: 0xa09c55 node::OnFatalError(char const*, char const*) [/tmp/build_b9f5f73838745ab373e3ebe59b8cb65f/.heroku/node/bin/node]
3: 0xb7d71e v8::Utils::ReportOOMFailure(v8::internal::Isolate*, char const*, bool) [/tmp/build_b9f5f73838745ab373e3ebe59b8cb65f/.heroku/node/bin/node]
4: 0xb7da99 v8::internal::V8::FatalProcessOutOfMemory(v8::internal::Isolate*, char const*, bool) [/tmp/build_b9f5f73838745ab373e3ebe59b8cb65f/.heroku/node/bin/node]
5: 0xd2a1f5 [/tmp/build_b9f5f73838745ab373e3ebe59b8cb65f/.heroku/node/bin/node]
6: 0xd2a886 v8::internal::Heap::RecomputeLimits(v8::internal::GarbageCollector) [/tmp/build_b9f5f73838745ab373e3ebe59b8cb65f/.heroku/node/bin/node]
7: 0xd37105 v8::internal::Heap::PerformGarbageCollection(v8::internal::GarbageCollector, v8::GCCallbackFlags) [/tmp/build_b9f5f73838745ab373e3ebe59b8cb65f/.heroku/node/bin/node]
8: 0xd37fb5 v8::internal::Heap::CollectGarbage(v8::internal::AllocationSpace, v8::internal::GarbageCollectionReason, v8::GCCallbackFlags) [/tmp/build_b9f5f73838745ab373e3ebe59b8cb65f/.heroku/node/bin/node]
9: 0xd3aa6c v8::internal::Heap::AllocateRawWithRetryOrFail(int, v8::internal::AllocationType, v8::internal::AllocationOrigin, v8::internal::AllocationAlignment) [/tmp/build_b9f5f73838745ab373e3ebe59b8cb65f/.heroku/node/bin/node]
10: 0xd0163b v8::internal::Factory::NewFillerObject(int, bool, v8::internal::AllocationType, v8::internal::AllocationOrigin) [/tmp/build_b9f5f73838745ab373e3ebe59b8cb65f/.heroku/node/bin/node]
11: 0x104300e v8::internal::Runtime_AllocateInYoungGeneration(int, unsigned long*, v8::internal::Isolate*) [/tmp/build_b9f5f73838745ab373e3ebe59b8cb65f/.heroku/node/bin/node]
12: 0x13c5b79 [/tmp/build_b9f5f73838745ab373e3ebe59b8cb65f/.heroku/node/bin/node]
Aborted
error Command failed with exit code 134.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
error Command failed with exit code 134.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
-----> Build failed
We're sorry this build is failing! You can troubleshoot common issues here:
https://devcenter.heroku.com/articles/troubleshooting-node-deploys
Some possible problems:
- Node version not specified in package.json
https://devcenter.heroku.com/articles/nodejs-support#specifying-a-node-js-version
Love,
Heroku
! Push rejected, failed to compile Node.js app.
! Push failed