-
Notifications
You must be signed in to change notification settings - Fork 319
Open
Labels
Description
What?
When multi-config scenario, when the second config's runtime has telemetry values set from environment variables that do not exist in the environment.
This is an @env() error, perhaps we should assume @akv() is also affected by this?
Details
This is a snippet of the master configuration in a multi-config scenario.
{
"$schema": "https://github.com/Azure/data-api-builder/releases/download/vmajor.minor.patch/dab.draft.schema.json",
"data-source": {
"database-type": "mssql",
"connection-string": "@env('MSSQL_CONNECTION_STRING')",
"options": {
"set-session-context": false
}
},
"data-source-files": [ "dab-config-2.json" ],This is a snippet of the second configuration file:
"telemetry": {
"open-telemetry": {
"enabled": true,
"endpoint": "@env('OTEL_EXPORTER_OTLP_ENDPOINT')",
"headers": "@env('OTEL_EXPORTER_OTLP_HEADERS')",
"service-name": "@env('OTEL_SERVICE_NAME')"
}
},Then, dab start throws an exception, which it should not do in ANY circumstance, especially runtime in a child configuration file:
Deserialization of the configuration file failed during a post-processing step.
Message:
Environmental Variable, OTEL_EXPORTER_OTLP_ENDPOINT, not found.
Stack Trace:
at Azure.DataApiBuilder.Config.DeserializationVariableReplacementSettings.ReplaceEnvVariable(Match match) in /_/src/Config/DeserializationVariableReplacementSettings.cs:line 143
at System.Text.RegularExpressions.Regex.<>c.<Replace>b__99_0(ValueTuple`5& state, Match match)
at System.Text.RegularExpressions.Regex.RunAllMatchesWithCallback[TState](String inputString, ReadOnlySpan`1 inputSpan, Int32 startat, TState& state, MatchCallback`1 callback, RegexRunnerMode mode, Boolean reuseMatchObject)
at System.Text.RegularExpressions.Regex.RunAllMatchesWithCallback[TState](String input, Int32 startat, TState& state, MatchCallback`1 callback, RegexRunnerMode mode, Boolean reuseMatchObject)
at System.Text.RegularExpressions.Regex.Replace(MatchEvaluator evaluator, Regex regex, String input, Int32 count, Int32 startat)
at System.Text.RegularExpressions.Regex.Replace(String input, MatchEvaluator evaluator)
at Azure.DataApiBuilder.Config.Converters.StringJsonConverterFactory.StringJsonConverter.Read(Utf8JsonReader& reader, Type typeToConvert, JsonSerializerOptions options) in /_/src/Config/Converters/StringJsonConverterFactory.cs:line 55
at System.Text.Json.Serialization.JsonConverter`1.TryRead(Utf8JsonReader& reader, Type typeToConvert, JsonSerializerOptions options, ReadStack& state, T& value, Boolean& isPopulatedValue)
at System.Text.Json.Serialization.JsonConverter`1.TryReadAsObject(Utf8JsonReader& reader, Type typeToConvert, JsonSerializerOptions options, ReadStack& state, Object& value)
And then, surprisingly, it still starts DAB with ONLY the first configuration.
Important
Exceptions during start should halt all startup
However
When you dab start the second config file directly, it starts without the exception.
Reactions are currently unavailable