This document presents possible causes and solutions for "RCP failed http 400 error" that occurs while pushing a project using heroku cli.
I didn't encounter this error and didn't change the default buffer size, I just gathered useful resources and shared the output of the sample running react-todo on heroku. Please be careful in troubleshooting and backup your project.
Below I list the most relevant resources on the subject.
-
Everything you need to know to resolve the Git Push RPC error: https://medium.com/swlh/everything-you-need-to-know-to-resolve-the-git-push-rpc-error-1a865fd1ebea
-
error: RPC failed result=22 - Push to Stash fails: https://confluence.atlassian.com/stashkb/error-rpc-failed-result-22-push-to-stash-fails-604537633.html
-
Stackoverflow "git RPC failed; HTTP 400 curl 22" https://stackoverflow.com/search?q=git+RPC+failed%3B+HTTP+400+curl+22
-
Demo application react-todo: https://github.com/serdarsen/react-todo
According to most sources I've read, this issue occurs when trying to send a very large file. For testing purposes I'm using ubuntu 22.04 and my demo application named react-todo. We can fallow steps below.
- Turn on git debug logging (Please check second resource for windows configuration)
srdr@asus:~/dev/react-todo$ export GIT_TRACE_PACKET=1
srdr@asus:~/dev/react-todo$ export GIT_TRACE=1
srdr@asus:~/dev/react-todo$ export GIT_CURL_VERBOSE=1
- Check heroku remote is https
srdr@asus:~/dev/react-todo$ git remote -v
heroku https://git.heroku.com/serdarsen-react-todo.git (fetch)
heroku https://git.heroku.com/serdarsen-react-todo.git (push)
origin [email protected]:serdarsen/react-todo.git (fetch)
origin [email protected]:serdarsen/react-todo.git (push)
- Check http.postBuffer and increase it (for react-todo I didn't change the default)
#Check
git config --global http.postBuffer
#Increase
git config --global http.postBuffer 157286400
- Test push again
heroku login
git push -u heroku main
srdr@asus:~/dev/react-todo$ git push -u heroku main
Enumerating objects: 15, done.
Counting objects: 100% (15/15), done.
Delta compression using up to 16 threads
Compressing objects: 100% (2/2), done.
Writing objects: 100% (9/9), 901 bytes | 901.00 KiB/s, done.
Total 9 (delta 7), reused 9 (delta 7), pack-reused 0
remote: Compressing source files... done.
remote: Building source:
remote:
remote: -----> Building on the Heroku-20 stack
remote: -----> Using buildpack: heroku/nodejs
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): 18.x
remote: engines.npm (package.json): 8.x
remote:
remote: Resolving node version 18.x...
remote: Downloading and installing node 18.8.0...
remote: Bootstrapping npm 8.x (replacing 8.18.0)...
remote: npm 8.18.0 installed
remote:
remote: -----> Restoring cache
remote: Cached directories were not restored due to a change in version of node, npm, yarn or stack
remote: Module installation may take longer for this build
remote:
remote: -----> Installing dependencies
remote: Installing node modules
remote:
remote: added 682 packages, and audited 683 packages in 10s
remote:
remote: 101 packages are looking for funding
remote: run `npm fund` for details
remote:
remote: 1 high severity vulnerability
remote:
remote: To address all issues, run:
remote: npm audit fix
remote:
remote: Run `npm audit` for details.
remote:
remote: -----> Build
remote: Running build
remote:
remote: > [email protected] build
remote: > webpack
remote:
remote: assets by info 151 KiB [immutable]
remote: asset main.5076f3ea3aa44f93003d.js 145 KiB [emitted] [immutable] [minimized] (name: main) 1 related asset
remote: asset main.5076f3ea3aa44f93003d.css 5.84 KiB [emitted] [immutable] (name: main)
remote: asset index.html 312 bytes [emitted]
remote: asset manifest.json 139 bytes [emitted]
remote: Entrypoint main 151 KiB = main.5076f3ea3aa44f93003d.css 5.84 KiB main.5076f3ea3aa44f93003d.js 145 KiB
remote: orphan modules 1.32 MiB (javascript) 11.9 KiB (runtime) [orphan] 100 modules
remote: cacheable modules 5.82 KiB (css/mini-extract) 1.45 MiB (javascript)
remote: modules by path ./src/ 5.82 KiB (css/mini-extract) 1.31 MiB (javascript)
remote: modules by path ./src/component/ 2.62 KiB 11 modules
remote: modules by path ./src/*.scss 83 bytes
remote: css ./node_modules/css-loader/dist/cjs.js!./node_modules/sass-loader/dist/cjs.js!./src/index.scss 83 bytes [built] [code generated]
remote: css ./node_modules/css-loader/dist/cjs.js!./node_modules/sass-loader/dist/cjs.js!./src/app.scss 0 bytes [built] [code generated]
remote: ./src/index.jsx + 20 modules 1.31 MiB [built] [code generated]
remote: css ./node_modules/css-loader/dist/cjs.js!./node_modules/sass-loader/dist/cjs.js!./src/index.scss (1) 3.12 KiB [built] [code generated]
remote: modules by path ./node_modules/ 143 KiB
remote: modules by path ./node_modules/react/ 7.98 KiB 4 modules
remote: modules by path ./node_modules/react-dom/ 131 KiB 3 modules
remote: modules by path ./node_modules/scheduler/ 4.33 KiB
remote: ./node_modules/scheduler/index.js 198 bytes [built] [code generated]
remote: ./node_modules/scheduler/cjs/scheduler.production.min.js 4.14 KiB [built] [code generated]
remote: webpack 5.73.0 compiled successfully in 6809 ms
remote:
remote: -----> Caching build
remote: - npm cache
remote:
remote: -----> Pruning devDependencies
remote:
remote: up to date, audited 71 packages in 2s
remote:
remote: 7 packages are looking for funding
remote: run `npm fund` for details
remote:
remote: found 0 vulnerabilities
remote:
remote: -----> Build succeeded!
remote: -----> Discovering process types
remote: Procfile declares types -> web
remote:
remote: -----> Compressing...
remote: Done: 56.8M
remote: -----> Launching...
remote: Released v11
remote: https://serdarsen-react-todo.herokuapp.com/ deployed to Heroku
remote:
remote: This app is using the Heroku-20 stack, however a newer stack is available.
remote: To upgrade to Heroku-22, see:
remote: https://devcenter.heroku.com/articles/upgrading-to-the-latest-stack
remote:
remote: Starting November 28th, 2022, free Heroku Dynos, free Heroku Postgres, and free Heroku Data for Redis® will no longer be available.
remote:
remote: If you have apps using any of these resources, you must upgrade to paid plans by this date to ensure your apps continue to run and to retain your data. For students, we will announce a new program by the end of September. Learn more at https://blog.heroku.com/next-chapter
remote:
remote: Verifying deploy... done.
To https://git.heroku.com/serdarsen-react-todo.git
a1d6c77..e9b2151 main -> main
Branch 'main' set up to track remote branch 'main' from 'heroku'.
Thanks. "git config --global http.postBuffer 157286400" fixed my problem with github desktop.