Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Failure on HTTP 503 #36

Closed
aaronparker opened this issue May 29, 2022 · 1 comment · Fixed by #40
Closed

Failure on HTTP 503 #36

aaronparker opened this issue May 29, 2022 · 1 comment · Fixed by #40
Assignees
Labels
bug Something isn't working ready to ship Feature is ready to be included in new version work started Work on this feature has started

Comments

@aaronparker
Copy link
Contributor

aaronparker commented May 29, 2022

Describe the bug
Not necessarily a bug, but an execption was rasied when the Graph API was unavailable. graph_request.py doesn't appear to handle HTTP 503 errors.

To Reproduce
Difficult to reproduce because you'll need the Graph API to be unavailable. I wouldn't expect this to be an issue very often.

Expected behavior
Not 100% sure, but graph_request.py could perhaps wait/retry or exit with an erorr.

Run type (please complete the following information):

  • Mode: 1
  • Client: Pipeline
  • Version: 1.1.0

Log

Traceback (most recent call last):
  File "/home/vsts/.local/bin/IntuneCD-startbackup", line 8, in <module>
    sys.exit(start())
  File "/home/vsts/.local/lib/python3.8/site-packages/IntuneCD/run_backup.py", line 136, in start
    run_backup(opts.path,opts.output,exclude,token)
  File "/home/vsts/.local/lib/python3.8/site-packages/IntuneCD/run_backup.py", line 68, in run_backup
    savebackup(path,output,exclude,token)
  File "/home/vsts/.local/lib/python3.8/site-packages/IntuneCD/backup_appConfiguration.py", line 49, in savebackup
    app_data = makeapirequest(app_endpoint + "/" + app_id, token)
  File "/home/vsts/.local/lib/python3.8/site-packages/IntuneCD/graph_request.py", line 38, in makeapirequest
    raise Exception('Request failed with ',response.status_code,' - ',
Exception: ('Request failed with ', 503, ' - ', '{"error":{"code":"UnknownError","message":"<!DOCTYPE HTML PUBLIC \\"-//W3C//DTD HTML 4.01//EN\\"\\"[http://www.w3.org/TR/html4/strict.dtd\\">\\r\\n<HTML><HEAD><TITLE>Service](http://www.w3.org/TR/html4/strict.dtd//%22%3E//r//n%3CHTML%3E%3CHEAD%3E%3CTITLE%3EService) Unavailable</TITLE>\\r\\n<META HTTP-EQUIV=\\"Content-Type\\" Content=\\"text/html; charset=us-ascii\\"></HEAD>\\r\\n<BODY><h2>Service Unavailable</h2>\\r\\n<hr><p>HTTP Error 503. The service is unavailable.</p>\\r\\n</BODY></HTML>\\r\\n","innerError":{"date":"2022-05-26T01:01:13","request-id":"c416c99b-a292-40bf-aed9-ab321f75ffc4","client-request-id":"c416c99b-a292-40bf-aed9-ab321f75ffc4"}}}')
##[error]Bash exited with code '1'.
##[error]Bash wrote one or more lines to the standard error stream.
##[error]Traceback (most recent call last):
  File "/home/vsts/.local/bin/IntuneCD-startbackup", line 8, in <module>
    sys.exit(start())
  File "/home/vsts/.local/lib/python3.8/site-packages/IntuneCD/run_backup.py", line 136, in start
    run_backup(opts.path,opts.output,exclude,token)
  File "/home/vsts/.local/lib/python3.8/site-packages/IntuneCD/run_backup.py", line 68, in run_backup
    savebackup(path,output,exclude,token)
  File "/home/vsts/.local/lib/python3.8/site-packages/IntuneCD/backup_appConfiguration.py", line 49, in savebackup
    app_data = makeapirequest(app_endpoint + "/" + app_id, token)
  File "/home/vsts/.local/lib/python3.8/site-packages/IntuneCD/graph_request.py", line 38, in makeapirequest
    raise Exception('Request failed with ',response.status_code,' - ',
Exception: ('Request failed with ', 503, ' - ', '{"error":{"code":"UnknownError","message":"<!DOCTYPE HTML PUBLIC \\"-//W3C//DTD HTML 4.01//EN\\"\\"[http://www.w3.org/TR/html4/strict.dtd\\">\\r\\n<HTML><HEAD><TITLE>Service](http://www.w3.org/TR/html4/strict.dtd//%22%3E//r//n%3CHTML%3E%3CHEAD%3E%3CTITLE%3EService) Unavailable</TITLE>\\r\\n<META HTTP-EQUIV=\\"Content-Type\\" Content=\\"text/html; charset=us-ascii\\"></HEAD>\\r\\n<BODY><h2>Service Unavailable</h2>\\r\\n<hr><p>HTTP Error 503. The service is unavailable.</p>\\r\\n</BODY></HTML>\\r\\n","innerError":{"date":"2022-05-26T01:01:13","request-id":"c416c99b-a292-40bf-aed9-ab321f75ffc4","client-request-id":"c416c99b-a292-40bf-aed9-ab321f75ffc4"}}}')
@aaronparker aaronparker added the bug Something isn't working label May 29, 2022
@almenscorner
Copy link
Owner

You are absolutely right, I added a retry for 502 and 504 but will make sure to include it for 503 as well in the next update!

@almenscorner almenscorner self-assigned this May 30, 2022
@almenscorner almenscorner added the work started Work on this feature has started label Jun 5, 2022
@almenscorner almenscorner added the ready to ship Feature is ready to be included in new version label Jun 27, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working ready to ship Feature is ready to be included in new version work started Work on this feature has started
Projects
Status: Shipped
Development

Successfully merging a pull request may close this issue.

2 participants