jayfk / jayfk/statuspage

Creation Error: Path Cannot Start With Slash

Open
#309 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
3.9k
Forks
180
PR merge metrics
No merged PRs in 30d

Description

Similar to #293.

## Error

When I run `statuspage create --token=`, I get the following error:

```
/usr/lib/python3/dist-packages/requests/__init__.py:89: RequestsDependencyWarning: urllib3 (1.26.12) or chardet (3.0.4) doesn't match a supported version!
warnings.warn("urllib3 ({}) or chardet ({}) doesn't match a supported "
Name: statuspage-test
Systems, eg (Website,API): SPORC-Cluster,KGCOE-GitLab,Mirrors,Documentation,OnDemand,Ticketing,Website,Grafana,Virtualization
Deleting initial labels: 100%|██████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 9/9 [00:01<00:00, 5.05it/s]
Creating status labels: 100%|███████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 3/3 [00:00<00:00, 4.87it/s]
Creating system labels: 100%|███████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 9/9 [00:02<00:00, 4.23it/s]
Traceback (most recent call last):
File "/usr/local/bin/statuspage", line 8, in
sys.exit(cli())
File "/usr/local/lib/python3.8/dist-packages/click/core.py", line 829, in __call__
return self.main(*args, **kwargs)
File "/usr/local/lib/python3.8/dist-packages/click/core.py", line 782, in main
rv = self.invoke(ctx)
File "/usr/local/lib/python3.8/dist-packages/click/core.py", line 1259, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File "/usr/local/lib/python3.8/dist-packages/click/core.py", line 1066, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "/usr/local/lib/python3.8/dist-packages/click/core.py", line 610, in invoke
return callback(*args, **kwargs)
File "/usr/local/lib/python3.8/dist-packages/statuspage/statuspage.py", line 65, in create
run_create(name=name, token=token, systems=systems, org=org, private=private)
File "/usr/local/lib/python3.8/dist-packages/statuspage/statuspage.py", line 257, in run_create
repo.create_file(
File "/usr/local/lib/python3.8/dist-packages/github/Repository.py", line 2090, in create_file
headers, data = self._requester.requestJsonAndCheck(
File "/usr/local/lib/python3.8/dist-packages/github/Requester.py", line 353, in requestJsonAndCheck
return self.__check(
File "/usr/local/lib/python3.8/dist-packages/github/Requester.py", line 378, in __check
raise self.__createException(status, responseHeaders, output)
github.GithubException.GithubException: 422 {"message": "path cannot start with a slash", "errors": [{"resource": "Commit", "field": "path", "code": "invalid"}], "documentation_url": "https://docs.github.com/rest/reference/repos#create-or
-update-file-contents"}
```

I verified that the repo `statuspage-test` does not exist. The repo gets created, but is empty.

## API Key

Checked Only:
- public_repo
- write:repo_hook

## Versions

- OS: Ubuntu 20.04 LTS
- Python: 3.8.10
- statuspage: 0.8.1
- PyGithub: 1.55

Contributor guide

No contributing guide indexed for this repository

Research direction

Reproduce `statuspage create --token=` with the reported versions, then inspect `statuspage/statuspage.py` at `create` line 65 and `run_create` line 257, especially the `repo.create_file` call. Confirm which path is sent to GitHub and verify that creation completes without the 422 error and leaves the repository populated.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
cli
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.