@@ -11,9 +11,9 @@ import * as RequestTracing from "./requestTracing/constants";
11
11
const TCP_ORIGIN = "_origin._tcp" ;
12
12
const ALT = "_alt" ;
13
13
const TCP = "_tcp" ;
14
- const EndpointSection = "Endpoint" ;
15
- const IdSection = "Id" ;
16
- const SecretSection = "Secret" ;
14
+ const Endpoint = "Endpoint" ;
15
+ const Id = "Id" ;
16
+ const Secret = "Secret" ;
17
17
const AzConfigDomainLabel = ".azconfig." ;
18
18
const AppConfigDomainLabel = ".appconfig." ;
19
19
const FallbackClientRefreshExpireInterval = 60 * 60 * 1000 ; // 1 hour in milliseconds
@@ -51,10 +51,10 @@ export class ConfigurationClientManager implements IConfigurationClientManager {
51
51
options = credentialOrOptions as AzureAppConfigurationOptions ;
52
52
this . #clientOptions = getClientOptions ( options ) ;
53
53
staticClient = new AppConfigurationClient ( connectionString , this . #clientOptions) ;
54
- this . #secret = parseConnectionString ( connectionString , SecretSection ) ;
55
- this . #id = parseConnectionString ( connectionString , IdSection ) ;
54
+ this . #secret = parseConnectionString ( connectionString , Secret ) ;
55
+ this . #id = parseConnectionString ( connectionString , Id ) ;
56
56
// TODO: need to check if it's CDN or not
57
- this . endpoint = parseConnectionString ( connectionString , EndpointSection ) ;
57
+ this . endpoint = parseConnectionString ( connectionString , Endpoint ) ;
58
58
59
59
} else if ( connectionStringOrEndpoint instanceof URL ) {
60
60
const credential = credentialOrOptions as TokenCredential ;
@@ -173,7 +173,7 @@ async function querySrvTargetHost(host) {
173
173
if ( isFailoverableEnv ( ) ) {
174
174
dns = require ( "dns/promises" ) ;
175
175
} else {
176
- return results ;
176
+ throw new Error ( "Failover is not supported in the current environment." ) ;
177
177
}
178
178
179
179
try {
@@ -215,7 +215,11 @@ async function querySrvTargetHost(host) {
215
215
}
216
216
}
217
217
} catch ( err ) {
218
- throw new Error ( `Failed to lookup origin SRV records: ${ err . message } ` ) ;
218
+ if ( err . code === "ENOTFOUND" ) {
219
+ return results ; // No SRV records found, return empty array
220
+ } else {
221
+ throw new Error ( `Failed to lookup SRV records: ${ err . message } ` ) ;
222
+ }
219
223
}
220
224
221
225
return results ;
@@ -264,7 +268,7 @@ function buildConnectionString(endpoint, secret, id) {
264
268
return "" ;
265
269
}
266
270
267
- return `${ EndpointSection } =${ endpoint } ;${ IdSection } =${ id } ;${ SecretSection } =${ secret } ` ;
271
+ return `${ Endpoint } =${ endpoint } ;${ Id } =${ id } ;${ Secret } =${ secret } ` ;
268
272
}
269
273
270
274
/**
0 commit comments