2017-04-24 2 views
0

Heroku에 내 create-react-app를 배포하는 데 문제가 있습니다. 이전에 잘 작동 했었고 이전에 만든 페이지가 여전히 작동합니다. 그러나, 내가 작성한 새 페이지는 다음과 같은 오류를 반환합니다 : 500 Internal Server Error nginx. 내가 만든 페이지 중 하나는 텍스트 만있는 테스트 페이지이며, 여전히이 오류가 발생합니다. 모든 것이 개발 단계에서 잘 작동합니다. 나는 레일 (5) API는 별도의 응용 프로그램으로 측면을 따라이 백엔드 실행하고 https://github.com/mars/create-react-app-buildpack.githeroku에게 create-react-app 배포

:

내가 만들-반응 - 응용 프로그램이 빌드 팩을 사용했다.

아래의 로그 및 heroku 로그를 작성하십시오. 또한 cors.rb 파일도 포함됩니다.

감사합니다. 여기

는 빌드 로그에 의해

Counting objects: 6, done. 
Delta compression using up to 8 threads. 
Compressing objects: 100% (6/6), done. 
Writing objects: 100% (6/6), 635 bytes | 0 bytes/s, done. 
Total 6 (delta 4), reused 0 (delta 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:  NPM_CONFIG_PRODUCTION=false 
remote:  NODE_VERBOSE=false 
remote:  NODE_ENV=development 
remote:  NODE_MODULES_CACHE=true 
remote: 
remote: -----> Installing binaries 
remote:  engines.node (package.json): unspecified 
remote:  engines.npm (package.json): unspecified (use default) 
remote:   
remote:  Resolving node version 6.x via semver.io... 
remote:  Downloading and installing node 6.10.2... 
remote:  Using default npm version: 3.10.10 
remote: 
remote: -----> Restoring cache 
remote:  Loading 2 from cacheDirectories (default): 
remote:  - node_modules 
remote:  - bower_components (not cached - skipping) 
remote: 
remote: -----> Building dependencies 
remote:  Installing node modules (package.json) 
remote: 
remote: -----> Caching build 
remote:  Clearing previous node cache 
remote:  Saving 2 cacheDirectories (default): 
remote:  - node_modules 
remote:  - bower_components (nothing to cache) 
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: 
remote: > [email protected] build /tmp/build_82771801fbb231c120504f2a4f013b93 
remote: > react-scripts build 
remote: 
remote: Creating an optimized production build... 
remote: Compiled successfully. 
remote: 
remote: File sizes after gzip: 
remote: 
remote: 79.01 KB build/static/js/main.2603c310.js 
remote: 289 B  build/static/css/main.9a0fe4f1.css 
remote: 
remote: The project was built assuming it is hosted at the server root. 
remote: To override this, specify the homepage in your package.json. 
remote: For example, add this to build it for GitHub Pages: 
remote: 
remote: "homepage": "http://myname.github.io/myapp", 
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: =====> Downloading Buildpack: https://github.com/heroku/heroku-buildpack-static.git 
remote: =====> Detected Framework: Static HTML 
remote: % Total % Received % Xferd Average Speed Time Time  Time Curren 
remote:         Dload Upload Total Spent Left Speed 
remote: 100 838k 100 838k 0  0 19.8M  0 --:--:-- --:--:-- --:--:-- 19.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: 33.6M 
remote: -----> Launching... 
remote:  Released v9 
remote:  https://APP-client.herokuapp.com/ deployed to Heroku 
remote: 
remote: Verifying deploy... done. 
To https://git.heroku.com/APP-client.git 
    be4d1c7..c03ddb2 master -> master 

Heroku가 로그 레일에

2017-04-24T13:24:09.365044+00:00 heroku[router]: at=info method=GET path="/ppty-list" host=app-client.herokuapp.com request_id=b5c46aa8-93ff-4ce5-9ef8-ed8245a43b66 fwd="100.38.166.199" dyno=web.1 connect=1ms service=6ms status=500 bytes=758 protocol=https 
2017-04-24T13:24:09.371231+00:00 app[web.1]: 2017/04/24 13:24:09 [error] 29#0: *13 mrb_run failed: return 500 HTTP status code to client: error: /app/bin/config/lib/ngx_mruby/headers.rb:7: invalid json (ArgumentError), client: 10.170.176.153, server: , request: "GET /ppty-list HTTP/1.1", host: "app-client.herokuapp.com" 
2017-04-24T13:24:09.374529+00:00 app[web.1]: 10.170.176.153 - - [24/Apr/2017:13:24:09 +0000] "GET /ppty-list HTTP/1.1" 500 588 "-" "Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/57.0.2987.133 Safari/537.36" 
2017-04-24T13:24:10.240848+00:00 heroku[router]: at=info method=GET path="/favicon.ico" host=app-client.herokuapp.com request_id=3f25570a-ba07-48d1-ac46-eab5c3eae537 fwd="100.38.166.199" dyno=web.1 connect=1ms service=2ms status=500 bytes=758 protocol=https 
2017-04-24T13:24:10.247480+00:00 app[web.1]: 2017/04/24 13:24:10 [error] 32#0: *14 mrb_run failed: return 500 HTTP status code to client: error: /app/bin/config/lib/ngx_mruby/headers.rb:7: invalid json (ArgumentError), client: 10.170.176.153, server: , request: "GET /favicon.ico HTTP/1.1", host: "app-client.herokuapp.com", referrer: "https://app-client.herokuapp.com/ppty-list" 
2017-04-24T13:24:10.255154+00:00 app[web.1]: 10.170.176.153 - - [24/Apr/2017:13:24:10 +0000] "GET /favicon.ico HTTP/1.1" 500 588 "https://app-client.herokuapp.com/ppty-list" "Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/57.0.2987.133 Safari/537.36" 

Cors.rb 파일

이다 나뿐만 아니라 Heroku가에서 함께 실행하고있어 유일한 응용 프로그램 (5) API.

Rails.application.config.middleware.insert_before 0, Rack::Cors do 
    allow do 
    origins 'https://app-<username>.c9users.io:8082' 

    resource '*', 
     headers: :any, 
     methods: [:get, :post, :put, :patch, :delete, :options, :head] 
    end 
    allow do 
    origins 'https://APP-server.herokuapp.com' 

    resource '*', 
     headers: :any, 
     methods: [:get, :post, :put, :patch, :delete, :options, :head] 
end 
end 
+0

당신은 API 클라이언트가 있습니까? – Dez

+0

예, 레일 5 API 만 지원되고 랙 - 깔개 보석을 사용하여 활성화 된 경우 config/initializers/cors.rb 파일의 주석을 지우십시오. 전체 cors.rb 파일로 질문을 업데이트하겠습니다. –

+0

package.json의 프로덕션 URL 및 포트를 사용하여 create-react-app에 대한 프록시 구성을 설정 했습니까? 참조 : https://github.com/facebookincubator/create-react-app/blob/master/packages/react-scripts/template/README.md#proxying-api-requests-in-development – Dez

답변

관련 문제