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

auth@edge: fix refreshauth error handling #458

Merged
merged 2 commits into from
Sep 21, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
## [Unreleased]
### Fixed
- fixed an issues causing static sites in regions other than us-east-1 to redirect to the s3 object until CloudFront was able to use the global endpoint of the bucket
- fixed uncaught static site auth@edge errors in refresh token handling

## [1.13.0] - 2020-09-14
### Added
Expand Down
4 changes: 1 addition & 3 deletions runway/hooks/staticsite/auth_at_edge/templates/shared.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
import logging
import re
import time
import traceback
from datetime import datetime
from random import random
from urllib import request # pylint: disable=no-name-in-module
Expand Down Expand Up @@ -304,9 +303,8 @@ def http_post_with_retry(url, data, headers):
except Exception as err:
LOGGER.error("HTTP POST to %s failed (attempt %s)", url, attempts)
LOGGER.error(err)
LOGGER.error(traceback.print_exc())
if attempts >= 5:
break
raise
if attempts >= 2:
# After attempting twice do some exponential backoff with jitter
time.sleep((25 * (pow(2, attempts) + random() * attempts)) / 1000)
Expand Down