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

read_yaml fails when it tries to expand an environment variable which contains a $ #7932

Closed
sentry-io bot opened this issue Feb 10, 2021 · 4 comments · Fixed by #8140 or #8382
Closed

read_yaml fails when it tries to expand an environment variable which contains a $ #7932

sentry-io bot opened this issue Feb 10, 2021 · 4 comments · Fixed by #8140 or #8382
Assignees
Labels
area:rasa-oss 🎡 Anything related to the open source Rasa framework area:rasa-oss/training-data Issues focused around Rasa training data (stories, NLU, domain, etc.) effort:atom-squad/2 Label which is used by the Rasa Atom squad to do internal estimation of task sizes. feature:ux-cli+training-data Feature: Improve user experience with Rasa CLI and training data for developers type:bug 🐛 Inconsistencies or issues which will cause an issue or problem for users or implementors.

Comments

@sentry-io
Copy link

sentry-io bot commented Feb 10, 2021

Sentry Issue: RASA-OPEN-SOURCE-1XP

ValueError: Error when trying to expand the environment variables in '${DB_PASSWORD}'. Please make sure to also set these environment variables: '['$dsfdsfwece2s3f']'.
(13 additional frame(s) were not displayed)
...
  File "rasa/utils/endpoints.py", line 26, in read_endpoint_config
    content = rasa.shared.utils.io.read_config_file(filename)
  File "rasa/shared/utils/io.py", line 527, in read_config_file
    content = read_yaml_file(filename)
  File "rasa/shared/utils/io.py", line 368, in read_yaml_file
    return read_yaml(read_file(filename, DEFAULT_ENCODING))
  File "rasa/shared/utils/io.py", line 349, in read_yaml
    return yaml_parser.load(content) or {}
  File "rasa/shared/utils/io.py", line 314, in env_var_constructor
    " variables: '{}'.".format(value, not_expanded)

To reproduce:

import os
from rasa.shared.utils.io import read_yaml

os.environ['HELLO'] = '$sdfdsf'

print(read_yaml("""
hello:
- ${HELLO}
"""))
@joejuzl joejuzl added type:bug 🐛 Inconsistencies or issues which will cause an issue or problem for users or implementors. area:rasa-oss/training-data Issues focused around Rasa training data (stories, NLU, domain, etc.) area:rasa-oss 🎡 Anything related to the open source Rasa framework labels Feb 10, 2021
@sentry-io
Copy link
Author

sentry-io bot commented Feb 12, 2021

Sentry issue: RASA-OPEN-SOURCE-12E

This is an example of when it is a user error and should be handled accordingly

@sentry-io
Copy link
Author

sentry-io bot commented Feb 15, 2021

Sentry issue: RASA-OPEN-SOURCE-665

@TyDunn TyDunn added the feature:ux-cli+training-data Feature: Improve user experience with Rasa CLI and training data for developers label Feb 17, 2021
@wochinge wochinge added the effort:atom-squad/2 Label which is used by the Rasa Atom squad to do internal estimation of task sizes. label Mar 5, 2021
@alwx alwx self-assigned this Mar 7, 2021
@wochinge
Copy link
Contributor

wochinge commented Apr 1, 2021

I think we have to make it a RasaException as this still raises a ValueError in case the user doesn't supply an env variable

@sentry-io
Copy link
Author

sentry-io bot commented May 2, 2021

Sentry issue: RASA-OPEN-SOURCE-8SV

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area:rasa-oss 🎡 Anything related to the open source Rasa framework area:rasa-oss/training-data Issues focused around Rasa training data (stories, NLU, domain, etc.) effort:atom-squad/2 Label which is used by the Rasa Atom squad to do internal estimation of task sizes. feature:ux-cli+training-data Feature: Improve user experience with Rasa CLI and training data for developers type:bug 🐛 Inconsistencies or issues which will cause an issue or problem for users or implementors.
Projects
None yet
4 participants