mars/heroku-cra-node

Receiving error due to heroku-postbuild script when deploying app

amesbahi opened this issue · 4 comments

Hello! I'm getting the output below when running git push heroku master:

Counting objects: 237, done.
Delta compression using up to 8 threads.
Compressing objects: 100% (223/223), done.
Writing objects: 100% (237/237), 251.29 KiB | 0 bytes/s, done.
Total 237 (delta 127), reused 35 (delta 9)
remote: Compressing source files... done.
remote: Building source:
remote: 
remote: -----> Node.js app detected
remote: 
remote: -----> Creating runtime environment
remote:        
remote:        NPM_CONFIG_LOGLEVEL=error
remote:        NODE_VERBOSE=false
remote:        NODE_ENV=production
remote:        NODE_MODULES_CACHE=true
remote: 
remote: -----> Installing binaries
remote:        engines.node (package.json):  8.4.0
remote:        engines.npm (package.json):   unspecified (use default)
remote:        
remote:        Resolving node version 8.4.0...
remote:        Downloading and installing node 8.4.0...
remote:        Using default npm version: 5.3.0
remote: 
remote: -----> Restoring cache
remote:        Skipping cache restore (not-found)
remote: 
remote: -----> Building dependencies
remote:        Installing node modules (package.json + package-lock)
remote:        
remote:        > nodemon@1.18.3 postinstall /tmp/build_4609f86de952cdb33e104d76e5f31362/node_modules/nodemon
remote:        > node bin/postinstall || exit 0
remote:        
remote:        added 398 packages in 9.532s
remote:        Running heroku-postbuild
remote:        
remote:        > weather-app@1.0.0 heroku-postbuild /tmp/build_4609f86de952cdb33e104d76e5f31362
remote:        > cd ./client && npm install && npm install --only=dev --no-shrinkwrap && npm run build
remote:        
remote: events.js:182
remote:       throw er; // Unhandled 'error' event
remote:       ^
remote: 
remote: Error: sha512-Td74QcvICAA0+qERawL2LXZm5t/gBtCcvSg79TLNPSvQ== integrity checksum failed when using sha512: wanted sha512-xcvICAA0+qERaVkRpwL2LXZm5t/gBtCB9STYEV1pg79TSvd5IDJMQ== but got sha512-rh+KuAW36YKo0vClhQzwPJNu65xLb7Mrt+eZhtLf6Mf25POlMwD1Fw==. (13865 bytes)
remote:     at Transform.on (/tmp/build_4609f86de952cdb33e104d76e5f31362/.heroku/node/lib/node_modules/npm/node_modules/ssri/index.js:275:19)
remote:     at emitNone (events.js:110:20)
remote:     at Transform.emit (events.js:207:7)
remote:     at endReadableNT (_stream_readable.js:1059:12)
remote:     at _combinedTickCallback (internal/process/next_tick.js:138:11)
remote:     at process._tickCallback (internal/process/next_tick.js:180:9)
remote: events.js:182
remote:       throw er; // Unhandled 'error' event
remote:       ^
remote: 
remote: Error: sha512-x95Td74QcvICAgSTYEV1p0WcvSg79TLNPSvd5IDJMQ== integrity checksum failed when using sha512: wanted sha512-x95Td74QcvICAAdwL2LXZm5t/gTYEV1p0WcvSg79TLNPSvd5IDJMQ== but got sha512-rh+Koj8FwPJNu65xLb7Mrt+eZht0IPTOlMwD1Fw==. (13865 bytes)
remote:     at Transform.on (/tmp/build_4609f86de952cdb33e104d76e5f31362/.heroku/node/lib/node_modules/npm/node_modules/ssri/index.js:275:19)
remote:     at emitNone (events.js:110:20)
remote:     at Transform.emit (events.js:207:7)
remote:     at endReadableNT (_stream_readable.js:1059:12)
remote:     at _combinedTickCallback (internal/process/next_tick.js:138:11)
remote:     at process._tickCallback (internal/process/next_tick.js:180:9)
remote: npm ERR! cancel after 1 retries!
remote: 
remote: npm ERR! A complete log of this run can be found in:
remote: npm ERR!     /tmp/npmcache.0Bxu1/_logs/2018-08-16T22_53_52_995Z-debug.log
remote: npm ERR! code ELIFECYCLE
remote: npm ERR! errno 1
remote: npm ERR! weather-app@1.0.0 heroku-postbuild: `cd ./client && npm install && npm install --only=dev --no-shrinkwrap && npm run build`
remote: npm ERR! Exit status 1
remote: npm ERR! 
remote: npm ERR! Failed at the weather-app@1.0.0 heroku-postbuild script.
remote: npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
remote: 
remote: npm ERR! A complete log of this run can be found in:
remote: npm ERR!     /tmp/npmcache.0Bxu1/_logs/2018-08-16T22_53_53_018Z-debug.log
remote: 
remote: -----> Build failed
remote:        
remote:        We're sorry this build is failing! You can troubleshoot common issues here:
remote:        https://devcenter.heroku.com/articles/troubleshooting-node-deploys
remote:        
remote:        If you're stuck, please submit a ticket so we can help:
remote:        https://help.heroku.com/
remote:        
remote:        Love,
remote:        Heroku
remote:        
remote:  !     Push rejected, failed to compile Node.js app.
remote: 
remote:  !     Push failed
remote: Verifying deploy...
remote: 
remote: !	Push rejected to atlantic-breezy-840.
remote: 
To https://git.heroku.com/atlantic-breezy-840.git
 ! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'https://git.heroku.com/atlantic-breezy-840.git'
mars commented

Based on the logs, it looks like the ssri module is throwing the error that breaks the build, and based on what I read about that module it looks like that error is occurring because there's some code that doesn't match an expected signature.

Does this build locally when you run cd react-ui/ && npm run build?

Are you implementing ssri yourself, or is this a transitive dependency from some other package in your project?

When I run the command you provided, I am able to create the production build successfully for deployment.

I am not implementing ssri myself; I believe the latter would be the case.

mars commented

You can use npm ls to find which package depends on ssri.

Then, look into this issue with that project/package.

It’s possible that this issue is related to this buildpack, but more likely related to expectations that package has about its build environment.

All right 😅 it looks like I was just pushing to master from my release branch instead of my master branch. This fixes the issue — thank you!