Skip to content

Commit 76bf86b

Browse files
committed
fix: cant deploy to same namespace if organization_id incorrectly set
1 parent 0f5972e commit 76bf86b

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

scw_serverless/deploy/backends/scaleway_api_backend.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ def _get_or_create_function(self, function: Function, namespace_id: str) -> str:
4242
namespace_id=namespace_id,
4343
runtime=function.runtime,
4444
privacy=function.privacy or sdk.FunctionPrivacy.PUBLIC,
45-
http_option=sdk.FunctionHttpOption.REDIRECTED,
45+
http_option=function.http_option or sdk.FunctionHttpOption.REDIRECTED,
4646
name=function.name,
4747
environment_variables=function.environment_variables,
4848
min_scale=function.min_scale,
@@ -59,7 +59,7 @@ def _get_or_create_function(self, function: Function, namespace_id: str) -> str:
5959
function_id=created_function.id,
6060
runtime=function.runtime,
6161
privacy=function.privacy or sdk.FunctionPrivacy.PUBLIC,
62-
http_option=sdk.FunctionHttpOption.REDIRECTED,
62+
http_option=function.http_option or sdk.FunctionHttpOption.REDIRECTED,
6363
environment_variables=function.environment_variables,
6464
min_scale=function.min_scale,
6565
max_scale=function.max_scale,

scw_serverless/utils/credentials.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ def get_scw_client(
1818
"""Attempts to load the profile. Will raise on invalid profiles."""
1919
client = Client.from_config_file_and_env(profile_name)
2020
_update_client_from_cli(client, secret_key, project_id, region)
21+
2122
return _validate_client(client)
2223

2324

@@ -47,3 +48,7 @@ def _update_client_from_cli(
4748
if not client.default_region:
4849
get_logger().info(f"No region was configured, using {DEFAULT_REGION}")
4950
client.default_region = DEFAULT_REGION
51+
52+
# Not used by the API framework
53+
# Can lead to issues if project_id does not belong to organization
54+
client.default_organization_id = None

0 commit comments

Comments
 (0)