{"action":"created","issue":{"url":"https://api.github.com/repos/redfin/react-server/issues/7","repository_url":"https://api.github.com/repos/redfin/react-server","labels_url":"https://api.github.com/repos/redfin/react-server/issues/7/labels{/name}","comments_url":"https://api.github.com/repos/redfin/react-server/issues/7/comments","events_url":"https://api.github.com/repos/redfin/react-server/issues/7/events","html_url":"https://github.com/redfin/react-server/pull/7","id":133044762,"number":7,"title":"When TRITON_CONFIGS is not defined, default to a null configuration.","user":{"login":"aickin","id":44199,"avatar_url":"https://avatars.githubusercontent.com/u/44199?v=3","gravatar_id":"","url":"https://api.github.com/users/aickin","html_url":"https://github.com/aickin","followers_url":"https://api.github.com/users/aickin/followers","following_url":"https://api.github.com/users/aickin/following{/other_user}","gists_url":"https://api.github.com/users/aickin/gists{/gist_id}","starred_url":"https://api.github.com/users/aickin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/aickin/subscriptions","organizations_url":"https://api.github.com/users/aickin/orgs","repos_url":"https://api.github.com/users/aickin/repos","events_url":"https://api.github.com/users/aickin/events{/privacy}","received_events_url":"https://api.github.com/users/aickin/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2016-02-11T18:08:21Z","updated_at":"2016-02-11T18:20:24Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/redfin/react-server/pulls/7","html_url":"https://github.com/redfin/react-server/pull/7","diff_url":"https://github.com/redfin/react-server/pull/7.diff","patch_url":"https://github.com/redfin/react-server/pull/7.patch"},"body":"This is a PR to address some of the errors I've had in making example sites. If you don't define TRITON_CONFIGS as an env variable, you get an error like: \r\n\r\n```\r\n2016-02-11T16:54:46.959Z - error: [react-server.core.renderMiddleware] Error rendering element 0 message=TRITON_CONFIGS environment variable required to start server., stack=Error: TRITON_CONFIGS environment variable required to start server.\r\n    at module.exports (/Users/sashaaickin/code/react-server-test-2/node_modules/react-server/target/server/config.js:17:11)\r\n    at getNonInternalConfigs (/Users/sashaaickin/code/react-server-test-2/node_modules/react-server/target/server/renderMiddleware.js:904:19)\r\n    at bootstrapClient (/Users/sashaaickin/code/react-server-test-2/node_modules/react-server/target/server/renderMiddleware.js:809:13)\r\n    at writeElements (/Users/sashaaickin/code/react-server-test-2/node_modules/react-server/target/server/renderMiddleware.js:773:4)\r\n    at doElement (/Users/sashaaickin/code/react-server-test-2/node_modules/react-server/target/server/renderMiddleware.js:601:3)\r\n    at /Users/sashaaickin/code/react-server-test-2/node_modules/react-server/target/server/renderMiddleware.js:609:11\r\n    at /Users/sashaaickin/code/react-server-test-2/node_modules/continuation-local-storage/context.js:74:17\r\n    at _fulfilled (/Users/sashaaickin/code/react-server-test-2/node_modules/q/q.js:834:54)\r\n    at self.promiseDispatch.done (/Users/sashaaickin/code/react-server-test-2/node_modules/q/q.js:863:30)\r\n    at Promise.promise.promiseDispatch (/Users/sashaaickin/code/react-server-test-2/node_modules/q/q.js:796:13)\r\n```\r\n\r\nIf you do define `TRITON_CONFIGS` but there's no `config.json` in that directory, then you get another, similar error about the file not existing. In either case, the render messes up and doesn't send down `window.__tritonState`, so the client code never reconnects.\r\n\r\nI'm not entirely sure if an empty `config.json` is valid, although it seems to work in my limited testing.\r\n\r\nLonger term, I think it may be best to follow the `eslint`/`babel` convention of having a `.reactserverrc` file and/or a section in `package.json`, but for now, this makes it so you don't have to make a dummy `config.json` just to get things running.\r\n\r\nNote that this code still throws an error if `TRITON_CONFIGS` is defined but there's no `config.json` in the directory. That's by design, as it seems like an error to me if you deliberately set the variable but don't have a config file there."},"comment":{"url":"https://api.github.com/repos/redfin/react-server/issues/comments/182988484","html_url":"https://github.com/redfin/react-server/pull/7#issuecomment-182988484","issue_url":"https://api.github.com/repos/redfin/react-server/issues/7","id":182988484,"user":{"login":"gigabo","id":115908,"avatar_url":"https://avatars.githubusercontent.com/u/115908?v=3","gravatar_id":"","url":"https://api.github.com/users/gigabo","html_url":"https://github.com/gigabo","followers_url":"https://api.github.com/users/gigabo/followers","following_url":"https://api.github.com/users/gigabo/following{/other_user}","gists_url":"https://api.github.com/users/gigabo/gists{/gist_id}","starred_url":"https://api.github.com/users/gigabo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gigabo/subscriptions","organizations_url":"https://api.github.com/users/gigabo/orgs","repos_url":"https://api.github.com/users/gigabo/repos","events_url":"https://api.github.com/users/gigabo/events{/privacy}","received_events_url":"https://api.github.com/users/gigabo/received_events","type":"User","site_admin":false},"created_at":"2016-02-11T18:20:24Z","updated_at":"2016-02-11T18:20:24Z","body":"> Longer term, I think it may be best to follow the `eslint`/`babel` convention of having a `.reactserverrc`\r\n\r\nYeah, that sounds cool.  Also, when there's a CLI, being able to point to config with a command-line option would nicer than setting an environment variable."}}