Skip to content

Automatic JSON deserialization of variables not working with AWS Secrets Manager secrets backend #50666

@tom-gordon

Description

@tom-gordon

Apache Airflow version

3.0.1

If "Other Airflow 2 version" selected, which one?

No response

What happened?

In Airflow 3, the deserialize_json=True parameter in Variable.get() is no longer automatically deserializing JSON strings when using AWS Secrets Manager as the secrets backend. The method returns a string type. Deserialization still works with variables created in Airflow and not stored in AWS Secrets Manager.

The connection I have stored as JSON in AWS Secrets Manager also no longer works in Airflow 3

What you think should happen instead?

No response

How to reproduce

  1. Configure your Airflow deployment to use AWS Secrets Manager as a secrets backend:
    https://airflow.apache.org/docs/apache-airflow-providers-amazon/stable/secrets-backends/aws-secrets-manager.html
    https://www.astronomer.io/docs/astro/secrets-backend/aws-secretsmanager/

  2. Store an Airflow variable as JSON in AWS Secrets Manager e.g. {"num1": 23, "num2": 42}

  3. Retrieve the variable in a DAG using Variable.get("my_json_variable", deserialize_json=True)

  4. the get() method will return the entire JSON as a string type

Operating System

Linux

Versions of Apache Airflow Providers

apache-airflow-providers-amazon==9.7.0

Deployment

Astronomer

Deployment details

No response

Anything else?

No response

Are you willing to submit PR?

  • Yes I am willing to submit a PR!

Code of Conduct

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions