Title: Add error metadata to index.html to forward backend errors · Issue #1907 · coder/coder · GitHub
Open Graph Title: Add error metadata to index.html to forward backend errors · Issue #1907 · coder/coder
X Title: Add error metadata to index.html to forward backend errors · Issue #1907 · coder/coder
Description: When the browser accesses the API for authentication redirection or accessing apps, displaying a JSON error isn't useful! In these circumstances, we should serve index.html with an injected error and status code to display. VS Code does ...
Open Graph Description: When the browser accesses the API for authentication redirection or accessing apps, displaying a JSON error isn't useful! In these circumstances, we should serve index.html with an injected error a...
X Description: When the browser accesses the API for authentication redirection or accessing apps, displaying a JSON error isn't useful! In these circumstances, we should serve index.html with an injected err...
Opengraph URL: https://github.com/coder/coder/issues/1907
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Add error metadata to index.html to forward backend errors","articleBody":"When the browser accesses the API for authentication redirection or accessing apps, displaying a JSON error isn't useful! In these circumstances, we should serve `index.html` with an injected error and status code to display.\r\n\r\nVS Code does this in meta tags with `{{WORKBENCH_WEB_CONFIGURATION}}`:\r\nhttps://github.com/microsoft/vscode/blob/8a8c175605bb3503dc4515700dfd8dcf68dac98b/src/vs/code/browser/workbench/workbench.html#L19-L20\r\n\r\nTo display a helpful error in the frontend, we should get the status code and response text:\r\n```html\r\n\u003cmeta id=\"api-response\" data-statuscode=\"{{API_STATUS_CODE}}\" data-message=\"{{API_MESSAGE}}\" />\r\n```\r\nAn example of this is accessing a web app, where it may be offline. This results in a 502 error right now, which isn't helpful to the user. We could send the following to the frontend instead:\r\n```html\r\n\u003cmeta id=\"api-response\" data-statuscode=\"404\" data-message=\"code-server isn't running! Make sure it's active on 'localhost:3000'.\" />\r\n```\r\nThis is injected dynamically using a string replace by our static server in Go. The frontend could register on a per-path basis to display *really friendly* errors, but for now we could do a catch-all by making our 404 page check if `data-statuscode` is set. If so, we'll display the error!","author":{"url":"https://github.com/kylecarbs","@type":"Person","name":"kylecarbs"},"datePublished":"2022-05-30T19:03:38Z","url":"https://github.com/coder/coder/issues/1907"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:8ab3e025-fa02-dc65-e23d-dc7fcfc46730 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | EC72:213839:2DE28CE:3AA8FDE:6B01B0AB |
| html-safe-nonce | ea17c5990e4bf1b4c73ee46d811a5ec28b832024a94ac66c54b9098cf88b7131 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJFQzcyOjIxMzgzOToyREUyOENFOjNBQThGREU6NkIwMUIwQUIiLCJ2aXNpdG9yX2lkIjoiNTI4NTA1MTM3OTQzNjU5NzQxOSIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 8a3d045413a1b6a749325a6b59ee72755777b9228d7cace82b877c921a0f0b1b |
| hovercard-subject-tag | issue:1253048313 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/coder/coder/1907/issue_layout |
| twitter:image | https://opengraph.githubassets.com/738e6f7e46ad63c329a79b24cdd74c5488c8d14816f133433901394251971f8b/coder/coder/issues/1907 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/738e6f7e46ad63c329a79b24cdd74c5488c8d14816f133433901394251971f8b/coder/coder/issues/1907 |
| og:image:alt | When the browser accesses the API for authentication redirection or accessing apps, displaying a JSON error isn't useful! In these circumstances, we should serve index.html with an injected error a... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | kylecarbs |
| hostname | github.com |
| expected-hostname | github.com |
| None | cc5dfdd32f62ebd3223cab3af3aa2b268d3605218237326a48a99d1efd89495c |
| turbo-cache-control | no-preview |
| go-import | github.com/coder/coder git https://github.com/coder/coder.git |
| octolytics-dimension-user_id | 95932066 |
| octolytics-dimension-user_login | coder |
| octolytics-dimension-repository_id | 440752086 |
| octolytics-dimension-repository_nwo | coder/coder |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 440752086 |
| octolytics-dimension-repository_network_root_nwo | coder/coder |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 8c77c9e8439031ad54c75a250694842892f693e1 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width