dataall
dataall copied to clipboard
wrong payload when UpdateEnvironment is called
Describe the bug
Currently when we call UpdateEnvironment
from the UI we pass all the available information ModifyEnvironmentInput
, further down the call we use this payload to make the necessary adjustments not only to the envrionment itself but to theier resources. For example when we enable MLStudio this code is being called and the payload is passed as data
. As you can see this code pulls the label
, tags
, vpcType
, etc from there.
Problems:
- The GQL contract doesn't mark those as NonNull and hence one can pass only the information that they want to change. For example just the environment parameters and this code will explode
- Accidentally we might update things that are not meant to be updated i.e
sagemakerStudioDomainName
(this needs a deeper investigation)
How to Reproduce
Currently this is not reproducible via the WebUI because we sent all the information but if you try to enable MLStudio via the SDK you will get the following stacktrace...
2024-09-13T12:15:10.909+03:00
[ERROR] 2024-09-13T09:15:10.906Z 2394a8b6-b51b-46e3-ad22-b3dd9ffdf24d decoding to str: need a bytes-like object, NoneType found
2024-09-13T12:15:10.909+03:00
GraphQL request:6:23
2024-09-13T12:15:10.909+03:00
5 | ) {
2024-09-13T12:15:10.909+03:00
6 | updateEnvironment(environmentUri: $environmentUri, input: $input) {
2024-09-13T12:15:10.909+03:00
| ^
2024-09-13T12:15:10.909+03:00
7 |
2024-09-13T12:15:10.909+03:00
Traceback (most recent call last):
2024-09-13T12:15:10.909+03:00
File "/usr/local/lib/python3.9/site-packages/graphql/execution/execute.py", line 523, in execute_field
2024-09-13T12:15:10.909+03:00
result = resolve_fn(source, info, **args)
2024-09-13T12:15:10.909+03:00
File "/home/app/dataall/base/api/__init__.py", line 56, in adapted
2024-09-13T12:15:10.909+03:00
response = resolver(
2024-09-13T12:15:10.909+03:00
File "/home/app/dataall/core/environment/api/resolvers.py", line 46, in update_environment
2024-09-13T12:15:10.909+03:00
if EnvironmentResourceManager.deploy_updated_stack(previous_resource_prefix, environment, data=input):
2024-09-13T12:15:10.909+03:00
File "/home/app/dataall/core/environment/services/environment_resource_manager.py", line 52, in deploy_updated_stack
File "/home/app/dataall/core/environment/services/environment_resource_manager.py", line 52, in deploy_updated_stack
2024-09-13T12:15:10.909+03:00
deploy_stack |= resource.update_env(session, environment, **kwargs)
2024-09-13T12:15:10.909+03:00
File "/home/app/dataall/modules/mlstudio/services/mlstudio_service.py", line 82, in update_env
2024-09-13T12:15:10.909+03:00
SagemakerStudioService.create_sagemaker_studio_domain(session, environment, **kwargs)
SagemakerStudioService.create_sagemaker_studio_domain(session, environment, **kwargs)
2024-09-13T12:15:10.909+03:00
File "/home/app/dataall/modules/mlstudio/services/mlstudio_service.py", line 211, in create_sagemaker_studio_domain
2024-09-13T12:15:10.909+03:00
domain = SageMakerStudioRepository.create_sagemaker_studio_domain(
2024-09-13T12:15:10.909+03:00
File "/home/app/dataall/modules/mlstudio/db/mlstudio_repositories.py", line 89, in create_sagemaker_studio_domain
2024-09-13T12:15:10.909+03:00
sagemakerStudioDomainName=slugify(data.get('label'), separator=''),
2024-09-13T12:15:10.909+03:00
File "/home/app/dataall/base/utils/slugify.py", line 102, in slugify
2024-09-13T12:15:10.909+03:00
text = str(text, 'utf-8', 'ignore')
2024-09-13T12:15:10.909+03:00
TypeError: decoding to str: need a bytes-like object, NoneType found
2024-09-13T12:15:10.909+03:00
The above exception was the direct cause of the following exception:
2024-09-13T12:15:10.909+03:00
Traceback (most recent call last):
2024-09-13T12:15:10.909+03:00
File "/usr/local/lib/python3.9/site-packages/graphql/execution/execute.py", line 523, in execute_field
2024-09-13T12:15:10.909+03:00
result = resolve_fn(source, info, **args)
2024-09-13T12:15:10.909+03:00
File "/home/app/dataall/base/api/__init__.py", line 56, in adapted
2024-09-13T12:15:10.909+03:00
response = resolver(
2024-09-13T12:15:10.909+03:00
File "/home/app/dataall/core/environment/api/resolvers.py", line 46, in update_environment
2024-09-13T12:15:10.909+03:00
if EnvironmentResourceManager.deploy_updated_stack(previous_resource_prefix, environment, data=input):
2024-09-13T12:15:10.909+03:00
File "/home/app/dataall/core/environment/services/environment_resource_manager.py", line 52, in deploy_updated_stack
2024-09-13T12:15:10.909+03:00
deploy_stack |= resource.update_env(session, environment, **kwargs)
2024-09-13T12:15:10.909+03:00
File "/home/app/dataall/modules/mlstudio/services/mlstudio_service.py", line 82, in update_env
2024-09-13T12:15:10.909+03:00
SagemakerStudioService.create_sagemaker_studio_domain(session, environment, **kwargs)
2024-09-13T12:15:10.909+03:00
File "/home/app/dataall/modules/mlstudio/services/mlstudio_service.py", line 211, in create_sagemaker_studio_domain
2024-09-13T12:15:10.909+03:00
domain = SageMakerStudioRepository.create_sagemaker_studio_domain(
2024-09-13T12:15:10.909+03:00
File "/home/app/dataall/modules/mlstudio/db/mlstudio_repositories.py", line 89, in create_sagemaker_studio_domain
2024-09-13T12:15:10.909+03:00
sagemakerStudioDomainName=slugify(data.get('label'), separator=''),
2024-09-13T12:15:10.909+03:00
File "/home/app/dataall/base/utils/slugify.py", line 102, in slugify
2024-09-13T12:15:10.909+03:00
text = str(text, 'utf-8', 'ignore')
2024-09-13T12:15:10.909+03:00
graphql.error.graphql_error.GraphQLError: decoding to str: need a bytes-like object, NoneType found
2024-09-13T12:15:10.909+03:00
GraphQL request:6:23
2024-09-13T12:15:10.909+03:00
5 | ) {
2024-09-13T12:15:10.909+03:00
6 | updateEnvironment(environmentUri: $environmentUri, input: $input) {
2024-09-13T12:15:10.909+03:00
| ^
Expected behavior
No response
Your project
No response
Screenshots
No response
OS
N/A
Python version
N/A
AWS data.all version
All
Additional context
No response