|
@@ -142,6 +142,8 @@ def save_token_to_config(token: str, code: str | None = None):
|
|
if code:
|
|
if code:
|
|
hosting_config["code"] = code
|
|
hosting_config["code"] = code
|
|
try:
|
|
try:
|
|
|
|
+ if not os.path.exists(constants.Reflex.DIR):
|
|
|
|
+ os.makedirs(constants.Reflex.DIR)
|
|
with open(constants.Hosting.HOSTING_JSON, "w") as config_file:
|
|
with open(constants.Hosting.HOSTING_JSON, "w") as config_file:
|
|
json.dump(hosting_config, config_file)
|
|
json.dump(hosting_config, config_file)
|
|
except Exception as ex:
|
|
except Exception as ex:
|
|
@@ -324,22 +326,22 @@ def prepare_deploy(
|
|
enabled_regions=response_json.get("enabled_regions"),
|
|
enabled_regions=response_json.get("enabled_regions"),
|
|
)
|
|
)
|
|
except httpx.RequestError as re:
|
|
except httpx.RequestError as re:
|
|
- console.error(f"Unable to prepare launch due to {re}.")
|
|
|
|
|
|
+ console.debug(f"Unable to prepare launch due to {re}.")
|
|
raise Exception(str(re)) from re
|
|
raise Exception(str(re)) from re
|
|
except httpx.HTTPError as he:
|
|
except httpx.HTTPError as he:
|
|
- console.error(f"Unable to prepare deploy due to {he}.")
|
|
|
|
|
|
+ console.debug(f"Unable to prepare deploy due to {he}.")
|
|
raise Exception(f"{he}") from he
|
|
raise Exception(f"{he}") from he
|
|
except json.JSONDecodeError as jde:
|
|
except json.JSONDecodeError as jde:
|
|
- console.error(f"Server did not respond with valid json: {jde}")
|
|
|
|
|
|
+ console.debug(f"Server did not respond with valid json: {jde}")
|
|
raise Exception("internal errors") from jde
|
|
raise Exception("internal errors") from jde
|
|
except (KeyError, ValidationError) as kve:
|
|
except (KeyError, ValidationError) as kve:
|
|
- console.error(f"The server response format is unexpected {kve}")
|
|
|
|
|
|
+ console.debug(f"The server response format is unexpected {kve}")
|
|
raise Exception("internal errors") from kve
|
|
raise Exception("internal errors") from kve
|
|
except ValueError as ve:
|
|
except ValueError as ve:
|
|
# This is a recognized client error, currently indicates forbidden
|
|
# This is a recognized client error, currently indicates forbidden
|
|
raise Exception(f"{ve}") from ve
|
|
raise Exception(f"{ve}") from ve
|
|
except Exception as ex:
|
|
except Exception as ex:
|
|
- console.error(f"Unexpected error: {ex}.")
|
|
|
|
|
|
+ console.debug(f"Unexpected error: {ex}.")
|
|
raise Exception("internal errors") from ex
|
|
raise Exception("internal errors") from ex
|
|
|
|
|
|
|
|
|
|
@@ -465,6 +467,7 @@ def deploy(
|
|
headers=authorization_header(token),
|
|
headers=authorization_header(token),
|
|
data=params.dict(exclude_none=True),
|
|
data=params.dict(exclude_none=True),
|
|
files=files,
|
|
files=files,
|
|
|
|
+ timeout=HTTP_REQUEST_TIMEOUT,
|
|
)
|
|
)
|
|
# If the server explicitly states bad request,
|
|
# If the server explicitly states bad request,
|
|
# display a different error
|
|
# display a different error
|