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

env.url broken after 9.3.3 upgrade #227

Closed
eltonplima opened this issue Aug 26, 2021 · 1 comment
Closed

env.url broken after 9.3.3 upgrade #227

eltonplima opened this issue Aug 26, 2021 · 1 comment

Comments

@eltonplima
Copy link

After upgrade from version 9.3.2 to 9.3.3 my docker build break with the following error:

Step 11/12 : RUN python3 manage.py collectstatic --noinput
2 ---> Running in d9ad8b5f7427
3Traceback (most recent call last):
4  File "/home/app/.local/lib/python3.8/site-packages/environs/__init__.py", line 117, in method
5    value = field.deserialize(value)
6  File "/home/app/.local/lib/python3.8/site-packages/environs/__init__.py", line 291, in deserialize
7    ret = super().deserialize(value, attr, data, **kwargs)
8  File "/home/app/.local/lib/python3.8/site-packages/marshmallow/fields.py", line 365, in deserialize
9    self._validate(output)
10  File "/home/app/.local/lib/python3.8/site-packages/marshmallow/fields.py", line 265, in _validate
11    self._validate_all(value)
12  File "/home/app/.local/lib/python3.8/site-packages/marshmallow/validate.py", line 89, in __call__
13    raise ValidationError(errors, **kwargs)
14marshmallow.exceptions.ValidationError: ['Not a valid URL.']
15
16The above exception was the direct cause of the following exception:
17
18Traceback (most recent call last):
19  File "manage.py", line 10, in <module>
20    execute_from_command_line(sys.argv)
21  File "/home/app/.local/lib/python3.8/site-packages/django/core/management/__init__.py", line 381, in execute_from_command_line
22    utility.execute()
23  File "/home/app/.local/lib/python3.8/site-packages/django/core/management/__init__.py", line 325, in execute
24    settings.INSTALLED_APPS
25  File "/home/app/.local/lib/python3.8/site-packages/django/conf/__init__.py", line 79, in __getattr__
26    self._setup(name)
27  File "/home/app/.local/lib/python3.8/site-packages/django/conf/__init__.py", line 66, in _setup
28    self._wrapped = Settings(settings_module)
29  File "/home/app/.local/lib/python3.8/site-packages/django/conf/__init__.py", line 157, in __init__
30    mod = importlib.import_module(self.SETTINGS_MODULE)
31  File "/usr/lib/python3.8/importlib/__init__.py", line 127, in import_module
32    return _bootstrap._gcd_import(name[level:], package, level)
33  File "<frozen importlib._bootstrap>", line 1014, in _gcd_import
34  File "<frozen importlib._bootstrap>", line 991, in _find_and_load
35  File "<frozen importlib._bootstrap>", line 975, in _find_and_load_unlocked
36  File "<frozen importlib._bootstrap>", line 671, in _load_unlocked
37  File "<frozen importlib._bootstrap_external>", line 848, in exec_module
38  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
39  File "/home/app/demo/settings.py", line 49, in <module>
40    MONGODB_URL: ParseResult = env.url(
41  File "/home/app/.local/lib/python3.8/site-packages/environs/__init__.py", line 120, in method
42    raise EnvValidationError(
43environs.EnvValidationError: Environment variable "MONGODB_URL" invalid: ['Not a valid URL.']
44The command '/bin/sh -c python3 manage.py collectstatic --noinput' returned a non-zero code: 1
45
46Exited with code exit status 1

This is the code to reproduce:

MONGODB_URL: ParseResult = env.url(
    "MONGODB_URL",
    default="mongodb://user:pass@mongo.example.local/db?authSource=admin",
    schemes={"mongodb", "mongodb+srv"},
    require_tld=False,
)

Here a complete flow:

asciicast

@eltonplima eltonplima changed the title Version 9.3.3 stop to work with URL env.url broken after 9.3.3 upgrade Aug 27, 2021
@sloria
Copy link
Owner

sloria commented Nov 14, 2021

Fixed is in 9.3.5

@sloria sloria closed this as completed Nov 14, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants