Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Build fails with web3@1.0.0-beta.52 on Heroku #2749

Closed
zemse opened this issue Apr 28, 2019 · 7 comments
Closed

Build fails with web3@1.0.0-beta.52 on Heroku #2749

zemse opened this issue Apr 28, 2019 · 7 comments
Labels
Needs Clarification Requires additional input

Comments

@zemse
Copy link

zemse commented Apr 28, 2019

Description

I was using web3@1.0.0-beta.37 in my project, deployed it on Heroku. It was fine except this exact issue 2071. My dApp worked fine on Chrome but seemed to not work on other browsers. This issue was fixed in PR #2564. I needed to upgrade to web3@1.0.0-beta.52 to solve my issue.

I created a new branch and upgraded to the latest web3 version. I went through the Big Number debugging successfully and making my dApp running locally fine. But when I attempted to deploy it on Heroku, the build failed. The only difference between the two branches is web3 versions (beta.37 successfully builds but beta.52 fails). I did not use any other package for Big Number issue, simply updated few lines of oldCode with web3.utils.toBN( oldCode ).toString() method.

Branch master with web3@1.0.0-beta.37
works fine locally, build succeeds on Heroku, iOS issue

Branch web3beta52onceAgain with web3@1.0.0-beta.52
works fine locally, build fails on Heroku, iOS issue fixed

Expected behavior

I expect my project to work on iOS and other non-chrome browsers (2071 issue).

Actual behavior

With web3@1.0.0-beta.37 it only works on chrome.
With web3@1.0.0-beta.52 it does work as expected locally but it doesn't successfully build on Heroku.

Steps to reproduce the behavior

git clone https://github.com/zemse/kickchainer.git
git checkout web3beta52onceAgain
heroku login
heroku create temp-zemse
git push -u heroku web3beta52onceAgain

Pushing to heroku remote will auto deploy it. You can login to heroku.com on browser to see the build error logs or you can manually deploy it there (also you will need to create an account (no credit card) if you don't have). (I'm pasting the error below).

Error Logs

This is the build log for branch web3beta52onceAgain.

-----> Node.js app detected
       
-----> Creating runtime environment
       
       NPM_CONFIG_LOGLEVEL=error
       NODE_ENV=production
       NODE_MODULES_CACHE=true
       NODE_VERBOSE=false
       
-----> Installing binaries
       engines.node (package.json):  unspecified
       engines.npm (package.json):   unspecified (use default)
       
       Resolving node version 10.x...
       Downloading and installing node 10.15.3...
       Using default npm version: 6.4.1
       
-----> Restoring cache
       - node_modules is checked into source control and cannot be cached
       
-----> Installing dependencies
       Prebuild detected (node_modules already exists)
       Rebuilding any native modules
       
       > uglifyjs-webpack-plugin@0.4.6 postinstall /tmp/build_5eaecf89afbf8fc6f1657c23dfd35551/node_modules/uglifyjs-webpack-plugin
       > node lib/post_install.js
       
       
       > web3@1.0.0-beta.52 postinstall /tmp/build_5eaecf89afbf8fc6f1657c23dfd35551/node_modules/web3
       > node angular-patch.js
       
       internal/modules/cjs/loader.js:584
           throw err;
           ^
       
       Error: Cannot find module '/tmp/build_5eaecf89afbf8fc6f1657c23dfd35551/node_modules/web3/angular-patch.js'
           at Function.Module._resolveFilename (internal/modules/cjs/loader.js:582:15)
           at Function.Module._load (internal/modules/cjs/loader.js:508:25)
           at Function.Module.runMain (internal/modules/cjs/loader.js:754:12)
           at startup (internal/bootstrap/node.js:283:19)
           at bootstrapNodeJSCore (internal/bootstrap/node.js:622:3)
       npm ERR! code ELIFECYCLE
       npm ERR! errno 1
       npm ERR! web3@1.0.0-beta.52 postinstall: `node angular-patch.js`
       npm ERR! Exit status 1
       npm ERR! 
       npm ERR! Failed at the web3@1.0.0-beta.52 postinstall script.
       npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
       
       npm ERR! A complete log of this run can be found in:
       npm ERR!     /tmp/npmcache.fUnsG/_logs/2019-04-28T10_52_56_748Z-debug.log
-----> 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_modules checked into source control
         https://blog.heroku.com/node-habits-2016#9-only-git-the-important-bits
       
       - Node version not specified in package.json
         https://devcenter.heroku.com/articles/nodejs-support#specifying-a-node-js-version
       
       - A module may be missing from 'dependencies' in package.json
         https://devcenter.heroku.com/articles/troubleshooting-node-deploys#ensure-you-aren-t-relying-on-untracked-dependencies
       
       Love,
       Heroku
       
 !     Push rejected, failed to compile Node.js app.
 !     Push failed

I have tried removing node_modules from source control. Specified node and npm version in package.json in branch web3beta52. But it led to even more nasty errors!

// there are lot of lines of logs before this which would make this issue post insanely long. To see entire log please go to https://www.dropbox.com/s/5crutkazx08nqak/web3beta52-build-logs.txt
      
       > uglifyjs-webpack-plugin@0.4.6 postinstall /tmp/build_acebeb4bd04b10ba2e60f3bec899fe49/node_modules/uglifyjs-webpack-plugin
       > node lib/post_install.js
       
       
       > web3@1.0.0-beta.52 postinstall /tmp/build_acebeb4bd04b10ba2e60f3bec899fe49/node_modules/web3
       > node angular-patch.js
       
       
       > kickstart2@1.0.0 postinstall /tmp/build_acebeb4bd04b10ba2e60f3bec899fe49
       > next build
       
       (node:643) MaxListenersExceededWarning: Possible EventEmitter memory leak detected. 11 SIGINT listeners added. Use emitter.setMaxListeners() to increase limit
       > Failed to build on /tmp/044ede3c-1cfb-44c5-902b-a3cda31fdf5b
       { Error: commons.js from UglifyJs
       Invalid assignment [commons.js:42221,26]
           at /tmp/build_acebeb4bd04b10ba2e60f3bec899fe49/node_modules/next/dist/server/build/index.js:182:21
           at emitRecords.err (/tmp/build_acebeb4bd04b10ba2e60f3bec899fe49/node_modules/webpack/lib/Compiler.js:269:13)
           at Compiler.emitRecords (/tmp/build_acebeb4bd04b10ba2e60f3bec899fe49/node_modules/webpack/lib/Compiler.js:375:38)
           at emitAssets.err (/tmp/build_acebeb4bd04b10ba2e60f3bec899fe49/node_modules/webpack/lib/Compiler.js:262:10)
           at applyPluginsAsyncSeries1.err (/tmp/build_acebeb4bd04b10ba2e60f3bec899fe49/node_modules/webpack/lib/Compiler.js:368:12)
           at next (/tmp/build_acebeb4bd04b10ba2e60f3bec899fe49/node_modules/tapable/lib/Tapable.js:218:11)
           at Compiler.compiler.plugin (/tmp/build_acebeb4bd04b10ba2e60f3bec899fe49/node_modules/webpack/lib/performance/SizeLimitsPlugin.js:99:4)
           at Compiler.applyPluginsAsyncSeries1 (/tmp/build_acebeb4bd04b10ba2e60f3bec899fe49/node_modules/tapable/lib/Tapable.js:222:13)
           at Compiler.afterEmit (/tmp/build_acebeb4bd04b10ba2e60f3bec899fe49/node_modules/webpack/lib/Compiler.js:365:9)
           at require.forEach.err (/tmp/build_acebeb4bd04b10ba2e60f3bec899fe49/node_modules/webpack/lib/Compiler.js:354:15)
         errors:
          [ 'commons.js from UglifyJs\nInvalid assignment [commons.js:42221,26]' ],
         warnings: [] }
       npm ERR! code ELIFECYCLE
       npm ERR! errno 1
       npm ERR! kickstart2@1.0.0 postinstall: `next build`
       npm ERR! Exit status 1
       npm ERR! 
       npm ERR! Failed at the kickstart2@1.0.0 postinstall script.
       npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
       
       npm ERR! A complete log of this run can be found in:
       npm ERR!     /tmp/npmcache.91AK0/_logs/2019-04-28T08_35_37_988Z-debug.log
-----> Build failed
       
       We're sorry this build is failing! You can troubleshoot common issues here:
       https://devcenter.heroku.com/articles/troubleshooting-node-deploys
       
       If you're stuck, please submit a ticket so we can help:
       https://help.heroku.com/
       
       Love,
       Heroku
       
 !     Push rejected, failed to compile Node.js app.
 !     Push failed

Gists

https://github.com/zemse/kickchainer/tree/master/ethereum
Contains:

  • Smart Contracts source code
  • compiled
  • ABI versions.

Versions

  • web3.js: 1.0.0-beta.37 and 1.0.0-beta.52
  • nodejs: v11.7.0
  • browser: Google Chrome - Version 74.0.3729.108 (Official Build) (64-bit)
  • ethereum node: Rinkeby from infura.io.
@zemse
Copy link
Author

zemse commented Apr 29, 2019

Well, I'm working on my branch web3beta52 and there was a UglifyJs error. So I replaced inbuilt UglifyJs with a package babili-webpack-plugin. It solved that error, but this is the next error. (I mean english next not nextjs).

A dependency 'websocket' in 'web3-providers-ws' seems to be having .git file according to this error in the build log on Heroku.

-----> Pruning devDependencies
       npm ERR! path /tmp/build_01769d61d363f484e52ff95e8381efac/node_modules/web3-providers-ws/node_modules/websocket
       npm ERR! code EISGIT
       npm ERR! git /tmp/build_01769d61d363f484e52ff95e8381efac/node_modules/web3-providers-ws/node_modules/websocket: Appears to be a git repo or submodule.
       npm ERR! git     /tmp/build_01769d61d363f484e52ff95e8381efac/node_modules/web3-providers-ws/node_modules/websocket
       npm ERR! git Refusing to remove it. Update manually,
       npm ERR! git or move it out of the way first.
       
       npm ERR! A complete log of this run can be found in:
       npm ERR!     /tmp/npmcache.T0PoA/_logs/2019-04-29T07_22_27_443Z-debug.log
-----> Build failed

@nivida
Copy link
Contributor

nivida commented Apr 29, 2019

Thanks for opening this issue and for providing all these detailed information!
I will test and fix it as soon as possible.

@nivida nivida added the Needs Clarification Requires additional input label Apr 29, 2019
@zemse
Copy link
Author

zemse commented May 2, 2019

Hi @nivida, I was experimenting with one thing. I was using web3@1.0.0-beta.37 and web3-providers@1.0.0-beta.53. I wanted to use 1.0.0-beta.53's provider as it works for me (issue 2071) and 1.0.0-beta.37 as it is not causing the build to fail. But it is giving an error UnhandledPromiseRejectionWarning. I saw by console logging that the HttpProvider output was slightly different in both versions.

Just wanted to ask if are these both versions incompatible with each other? Also, what can we do to make the build succeed (I don't want to use the old version because the new provider is better)?

@nivida
Copy link
Contributor

nivida commented May 2, 2019

Thanks for the answer!:)

Just wanted to ask if are these both versions incompatible with each other? Also, what can we do to make the build succeed (I don't want to use the old version because the new provider is better)?

The version beta.37 does not support the providers from version beta.53. The solution would be to upgrade to the latest version.

@nivida nivida closed this as completed May 2, 2019
@hems
Copy link

hems commented Jun 12, 2019

I wonder why does the building work locally and fails at Heroku, it's very weird and unexpected behaviour.

I'm having pretty much the same issue, i'll play with the version and see what happens, i'm pretty sure the version of node.js used might be one of the important variables here as i'm sure i'm running the same version that is fail to compile on Heroku now on an older Heroku dyno that is likely to be running an older version of node or npm.

@piijt
Copy link

piijt commented Dec 17, 2019

How did you make your deployment work?

@its-mushon
Copy link

check out this. sounds very cool
https://www.okami.sh/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Needs Clarification Requires additional input
Projects
None yet
Development

No branches or pull requests

5 participants