Skip to content

Commit

Permalink
added instructions for troubleshooting codespace connectivity v2 issue
Browse files Browse the repository at this point in the history
  • Loading branch information
rongxin-liu committed May 29, 2024
1 parent 3dc1906 commit 1ea15fc
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 2 deletions.
36 changes: 35 additions & 1 deletion cs50.dev.md
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ Note that scopes are not as granular as would be ideal. The `codespace` scope te

When you log into Visual Studio Code for CS50, your codespace is configured with a "token" that has `repo` [scope](https://docs.github.com/en/developers/apps/building-oauth-apps/scopes-for-oauth-apps#available-scopes), which lets `git` access repositories to which your GitHub account has access.

If you try to access a repository that's owned by an [organization](https://docs.github.com/en/organizations/collaborating-with-groups-in-organizations/about-organizations) that has not granted access to Visual Studio Code for CS50, though, `git` might err with "Repository not found." (And `gh` might err with "Could not resolve to a Repository.") To grant (or request) access for that organization, visit [github.com/settings/connections/applications/d1a90a524497a69391fa](https://github.com/settings/connections/applications/d1a90a524497a69391fa). Alternatively, you can configure your codespace to use [SSH](/github/#ssh) or a [personal access token](/github/#personal-access-token) instead, both of which would have access to any repositories to which your GitHub account has access, whether or not owned by an organization.
If you try to access a repository that's owned by an [organization](https://docs.github.com/en/organizations/collaborating-with-groups-in-organizations/about-organizations) that has not granted access to Visual Studio Code for CS50, though, `git` might err with "Repository not found." (And `gh` might err with "Could not resolve to a Repository.") To grant (or request) access for that organization, visit [github.com/settings/connections/applications/d1a90a524497a69391fa](https://github.com/settings/connections/applications/d1a90a524497a69391fa). Alternatively, you can configure your codespace to use [SSH](https://cs50.readthedocs.io/github/#ssh) or a [personal access token](https://cs50.readthedocs.io/github/#personal-access-token) instead, both of which would have access to any repositories to which your GitHub account has access, whether or not owned by an organization.

### Domains

Expand All @@ -163,6 +163,40 @@ If on a corporate or school network that blocks any of the above, you might need

## Troubleshooting

### I'm seeing "Oh no, it looks like you are offline" error message.

First of all, make sure all the required [domains](https://cs50.readthedocs.io/cs50.dev/#domains) are not blocked by your device or internet environment.

Check that you have a stable internet connection and that your home, school, or company network is not blocking the connection. If possible, check logging for rejected connections on your device.

To inspect network activity in your browser, follow one of these instructions:

* [Chrome](https://developer.chrome.com/docs/devtools)
* [FireFox](https://firefox-source-docs.mozilla.org/devtools-user/network_monitor/)
* [Safari](https://developer.apple.com/documentation/safari-developer-tools/inspecting-safari-macos)

If you see rejected connections, make sure the domains documented by the `/meta` REST API endpoint are not blocked by your firewall. Again, in other words, none of [these domains](https://cs50.readthedocs.io/cs50.dev/#domains) should be blocked.

Optional: For more information, see ["REST API endpoints for meta data."](https://docs.github.com/en/rest/meta/meta#get-github-meta-information)

You can run this command in your terminal to get the list of domains required by GitHub Codespaces:

```bash
curl -L \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer <YOUR-TOKEN>" \
-H "X-GitHub-Api-Version: 2022-11-28" \
https://api.github.com/meta
```

Follow [this instruction](https://cs50.readthedocs.io/github/#personal-access-token) to generate a GitHub personal access token.

Alternatively, to get the list of domains required by GitHub Codespaces, execute the following command using [GitHub CLI](https://cli.github.com/):

```bash
gh api meta | jq .domains.codespaces
```

### How to monitor global variables in debugger

In debug50's **RUN AND DEBUG** pane, there's a section labeled **WATCH**. You can add expressions to this section, and the debugger will show you the values of these expressions as you step through the program. The expressions can include global variables and array names.
Expand Down
2 changes: 1 addition & 1 deletion libraries/cs50/python.rst
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ Usage
- for ``INSERT``, the primary key of a newly inserted row (or ``None`` if none)
- for ``SELECT``, a :py:class:`list` of :py:class:`dict` objects, each of which represents a row in the result set
- for ``UPDATE``, the number of rows updated
- on integrity errors, a :py:class:`ValueError` is raised
- on integrity errors (as when a constraint is violated), a :py:class:`ValueError` is raised
- on other errors, a :py:class:`RuntimeError` is raised

Example usage::
Expand Down

0 comments on commit 1ea15fc

Please sign in to comment.