500 Internal Server Error after adding static.json with basic_auth
peterblockman opened this issue · 2 comments
peterblockman commented
My app was working. After I added static.json, I got the error. Please take a look. thank you in advance.
Description
- Add static.json in the root folder with the content below
{
"root": "build/",
"routes": {
"/**": "index.html"
},
"basic_auth": true
}
- Set user name and password
heroku config:set BASIC_AUTH_USERNAME=admin
heroku config:set BASIC_AUTH_PASSWORD=password_hash
- commit and push
What I have tried
- Delete static.json and push again. still got the error
- I have tried this, but didn't work.
heroku logs -t
2020-06-01T03:53:50.789826+00:00 app[web.1]: 2020/06/01 03:53:50 [crit] 36#0: *33 crypt_r() failed (22: Invalid argument), client: 10.63.237.123, server: , request: "GET / HTTP/1.1", host: "app-name.herokuapp.com"
2020-06-01T03:53:50.790667+00:00 app[web.1]: 10.63.237.123 - abc [01/Jun/2020:03:53:50 +0000] "GET / HTTP/1.1" 500 588 "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/81.0.4044.138 Safari/537.36"
2020-06-01T03:53:51.645037+00:00 heroku[router]: at=info method=GET path="/favicon.ico" host=app-name.herokuapp.com request_id=c9d40fbe-8031-42de-a22b-4ce691559cb8 fwd="150.249.197.27" dyno=web.1 connect=0ms service=2ms status=500 bytes=758 protocol=https
2020-06-01T03:53:51.645087+00:00 app[web.1]: 2020/06/01 03:53:51 [crit] 38#0: *34 crypt_r() failed (22: Invalid argument), client: 10.63.237.123, server: , request: "GET /favicon.ico HTTP/1.1", host: "app-name.herokuapp.com", referrer: "https://app-name.herokuapp.com/"
2020-06-01T03:53:51.645924+00:00 app[web.1]: 10.63.237.123 - abc [01/Jun/2020:03:53:51 +0000] "GET /favicon.ico HTTP/1.1" 500 588 "https://app-name.herokuapp.com/" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/81.0.4044.138 Safari/537.36"
2020-06-01T04:06:00.111974+00:00 heroku[router]: at=info method=GET path="/" host=app-name.herokuapp.com request_id=1f8f2aae-91e8-473f-8dc7-f37d8c81c193 fwd="150.249.197.27" dyno=web.1 connect=2ms service=8ms status=500 bytes=758 protocol=https
2020-06-01T04:06:00.110018+00:00 app[web.1]: 2020/06/01 04:06:00 [crit] 37#0: *40 crypt_r() failed (22: Invalid argument), client: 10.7.155.197, server: , request: "GET / HTTP/1.1", host: "app-name.herokuapp.com"
2020-06-01T04:06:00.123880+00:00 app[web.1]: 10.7.155.197 - abc [01/Jun/2020:04:06:00 +0000] "GET / HTTP/1.1" 500 588 "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/81.0.4044.138 Safari/537.36"
2020-06-01T04:06:01.287335+00:00 heroku[router]: at=info method=GET path="/favicon.ico" host=app-name.herokuapp.com request_id=2f5237ca-6778-46b7-bf0d-d02c2fb7d5ab fwd="150.249.197.27" dyno=web.1 connect=1ms service=3ms status=500 bytes=758 protocol=https
2020-06-01T04:06:01.285679+00:00 app[web.1]: 2020/06/01 04:06:01 [crit] 37#0: *41 crypt_r() failed (22: Invalid argument), client: 10.7.155.197, server: , request: "GET /favicon.ico HTTP/1.1", host: "app-name.herokuapp.com", referrer: "https://app-name.herokuapp.com/"
2020-06-01T04:06:01.288243+00:00 app[web.1]: 10.7.155.197 - abc [01/Jun/2020:04:06:01 +0000] "GET /favicon.ico HTTP/1.1" 500 588 "https://app-name.herokuapp.com/" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/81.0.4044.138 Safari/537.36"
build log
Enumerating objects: 4, done.
Counting objects: 100% (4/4), done.
Delta compression using up to 4 threads
Compressing objects: 100% (3/3), done.
Writing objects: 100% (3/3), 350 bytes | 350.00 KiB/s, done.
Total 3 (delta 1), reused 0 (delta 0), pack-reused 0
remote: Compressing source files... done.
remote: Building source:
remote:
remote: -----> React.js (create-react-app) multi app detected
remote: =====> Downloading Buildpack: https://github.com/heroku/heroku-buildpack-multi.git
remote: =====> Detected Framework: Multipack
remote: =====> Downloading Buildpack: https://github.com/heroku/heroku-buildpack-nodejs.git
remote: =====> Detected Framework: Node.js
remote:
remote: -----> Creating runtime environment
remote:
remote: NPM_CONFIG_LOGLEVEL=error
remote: NODE_ENV=production
remote: NODE_MODULES_CACHE=true
remote: NODE_VERBOSE=false
remote:
remote: -----> Installing binaries
remote: engines.node (package.json): unspecified
remote: engines.npm (package.json): unspecified (use default)
remote:
remote: Resolving node version 12.x...
remote: Downloading and installing node 12.17.0...
remote: Using default npm version: 6.14.4
remote:
remote: -----> Restoring cache
remote: - node_modules
remote:
remote: -----> Installing dependencies
remote: Installing node modules (package.json + package-lock)
remote: audited 2490 packages in 20.625s
remote:
remote: 73 packages are looking for funding
remote: run `npm fund` for details
remote:
remote: found 18772 low severity vulnerabilities
remote: run `npm audit fix` to fix them, or `npm audit` for details
remote:
remote: -----> Build
remote: Detected both "build" and "heroku-postbuild" scripts
remote: Running heroku-postbuild
remote:
remote: > app-name@0.1.0 heroku-postbuild /tmp/build_2e7aea1714396ec143eb34d79b63756b
remote: > npm run build
remote:
remote:
remote: > app-name@0.1.0 build /tmp/build_2e7aea1714396ec143eb34d79b63756b
remote: > react-scripts build
remote:
remote: Creating an optimized production build...
remote: Compiled successfully.
remote:
remote: File sizes after gzip:
remote:
remote: 313.68 KB build/static/js/2.baf9ddd3.chunk.js
remote: 6.87 KB build/static/js/main.82c3ba97.chunk.js
remote: 1.6 KB build/static/css/2.d694ff75.chunk.css
remote: 779 B build/static/js/runtime-main.477d96e4.js
remote: 524 B build/static/css/main.07470614.chunk.css
remote:
remote: The project was built assuming it is hosted at /.
remote: You can control this with the homepage field in your package.json.
remote:
remote: The build folder is ready to be deployed.
remote: You may serve it with a static server:
remote:
remote: npm install -g serve
remote: serve -s build
remote:
remote: Find out more about deployment here:
remote:
remote: bit.ly/CRA-deploy
remote:
remote:
remote: -----> Caching build
remote: - node_modules
remote:
remote: -----> Pruning devDependencies
remote: removed 209 packages and audited 2280 packages in 19.092s
remote:
remote: 55 packages are looking for funding
remote: run `npm fund` for details
remote:
remote: found 18751 low severity vulnerabilities
remote: run `npm audit fix` to fix them, or `npm audit` for details
remote:
remote: -----> Build succeeded!
remote: =====> Downloading Buildpack: https://github.com/mars/create-react-app-inner-buildpack.git
remote: =====> Detected Framework: React.js (create-react-app)
remote: Using existing `static.json`
remote: Enabling runtime environment variables
remote: =====> Downloading Buildpack: https://github.com/heroku/heroku-buildpack-static.git
remote: =====> Detected Framework: Static HTML
remote: % Total % Received % Xferd Average Speed Time Time Time Current
remote: Dload Upload Total Spent Left Speed
remote: 0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--remote: 17 838k 17 144k 0 0 4114k 0 --:--:-- --:--:-- --:--remote: 100 838k 100 838k 0 0 13.2M 0 --:--:-- --:--:-- --:--:-- 12.9M
remote: -----> Installed directory to /app/bin
remote: Using release configuration from last framework (Static HTML).
remote: -----> Discovering process types
remote: Procfile declares types -> (none)
remote: Default types for buildpack -> web
remote:
remote: -----> Compressing...
remote: Done: 87.5M
remote: -----> Launching...
remote: Released v4
remote: https://app-name.herokuapp.com/ deployed to Heroku
remote:
remote: Verifying deploy... done.
To https://git.heroku.com/app-name.git
browser console
GET https://app-name.herokuapp.com/ 500 (Internal Server Error)
GET https://app-name.herokuapp.com/favicon.ico 500 (Internal Server Error)
mars commented
Basic auth is a feature provided by the static buildpack.
Please search for & open issues for it in its repo.
mars commented
The error you posted crypt_r() failed
looks like maybe your password is not formatted correctly.
Make sure to generate the password as directed by the instructions in the static buildpack:
Passwords set via
BASIC_AUTH_PASSWORD
can be generated using OpenSSL or Apache Utils.For instance:
openssl passwd -apr1