Custom deep variables (still) appear not to be correctly resolved
This is a Bug Report
====================

Description
-----------

A follow up to  #4946
(and https://github.com/amplify-education/serverless-domain-manager/issues/124)

For bug reports:

-   What went wrong?\
    My deep custom serverless variables aren't resolved properly.

-   What did you expect should have happened?\
    The variables should be resolved correctly.

-   What was the config you used?\
    Using this config:

Config relevant base part:

```
plugins:
  - serverless-domain-manager

provider:
    stage: ${opt:stage, self:custom.defaultStage}

custom:
  defaultStage: dev

  customDomain:
    domainName: ${self:custom.apiFQDN}
```

and 2 different custom configs:


1)
```
custom
  SLD: mydomain.com
  apiHost: api
  hostPostfix:
    dev: -dev
    staging: -staging
    test: -test
  apiFQDN: ${self:custom.apiHost}${self:custom.hostPostfix.${self:provider.stage}, ''}.${self:custom.SLD}

```

2)
```
custom:
  SLD: mydomain.com
  hostPostfix:
    dev: -dev
    staging: -staging
    test: -test
  apiHost: api${self:custom.hostPostfix.${self:provider.stage}, ''}
  apiFQDN: ${self:custom.apiHost}.${self:custom.SLD}

  
```


The .serverless/serverless-state.json looks good in both variants:

```
"customDomain": {
  "domainName": "api-staging.mydomain.com",
  ...
}
```
But running:

```
sls info --stage staging

```
The CLI output on 1 is
```
Error --------------------------------------------------
 
Error: Domain manager summary logging failed.
Error: Error: 'self:custom.apiHost.self:custom.SLD' could not be found in API Gateway.
NotFoundException: Invalid domain name identifier specified
```

The CLI output on 2 is
```
Error --------------------------------------------------
 
Error: Domain manager summary logging failed.
Error: Error: 'api.mydomain.com' could not be found in API Gateway.
NotFoundException: Invalid domain name identifier specified
```
-   What stacktrace or error message from your provider did you see?

```
NotFoundException: Invalid domain name identifier specified
    at getDomain.then.catch (/path/project/node_modules/serverless-domain-manager/index.js:225:13)
    at <anonymous>
    at process._tickDomainCallback (internal/process/next_tick.js:228:7)
From previous event:
    at PluginManager.invoke (/path/project/node_modules/serverless/lib/classes/PluginManager.js:372:22)
    at PluginManager.run (/path/project/node_modules/serverless/lib/classes/PluginManager.js:403:17)
    at variables.populateService.then (/path/project/node_modules/serverless/lib/Serverless.js:102:33)
    at runCallback (timers.js:789:20)
    at tryOnImmediate (timers.js:751:5)
    at processImmediate [as _immediateCallback] (timers.js:722:5)
From previous event:
    at Serverless.run (/path/project/node_modules/serverless/lib/Serverless.js:89:74)
    at serverless.init.then (/path/project/node_modules/serverless/bin/serverless:42:50)
    at <anonymous>

```

Additional Data
---------------

-   ***Serverless Framework Version you're using***: 1.27.2
-   ***Operating System***: macos
-   ***Stack Trace***: above
-   ***Provider Error messages***: ?

Custom deep variables (still) appear not to be correctly resolved
This is a Bug Report
====================

Description
-----------

A follow up to  #4946
(and https://github.com/amplify-education/serverless-domain-manager/issues/124)

For bug reports:

-   What went wrong?\
    My deep custom serverless variables aren't resolved properly.

-   What did you expect should have happened?\
    The variables should be resolved correctly.

-   What was the config you used?\
    Using this config:

Config relevant base part:

```
plugins:
  - serverless-domain-manager

provider:
    stage: ${opt:stage, self:custom.defaultStage}

custom:
  defaultStage: dev

  customDomain:
    domainName: ${self:custom.apiFQDN}
```

and 2 different custom configs:


1)
```
custom
  SLD: mydomain.com
  apiHost: api
  hostPostfix:
    dev: -dev
    staging: -staging
    test: -test
  apiFQDN: ${self:custom.apiHost}${self:custom.hostPostfix.${self:provider.stage}, ''}.${self:custom.SLD}

```

2)
```
custom:
  SLD: mydomain.com
  hostPostfix:
    dev: -dev
    staging: -staging
    test: -test
  apiHost: api${self:custom.hostPostfix.${self:provider.stage}, ''}
  apiFQDN: ${self:custom.apiHost}.${self:custom.SLD}

  
```


The .serverless/serverless-state.json looks good in both variants:

```
"customDomain": {
  "domainName": "api-staging.mydomain.com",
  ...
}
```
But running:

```
sls info --stage staging

```
The CLI output on 1 is
```
Error --------------------------------------------------
 
Error: Domain manager summary logging failed.
Error: Error: 'self:custom.apiHost.self:custom.SLD' could not be found in API Gateway.
NotFoundException: Invalid domain name identifier specified
```

The CLI output on 2 is
```
Error --------------------------------------------------
 
Error: Domain manager summary logging failed.
Error: Error: 'api.mydomain.com' could not be found in API Gateway.
NotFoundException: Invalid domain name identifier specified
```
-   What stacktrace or error message from your provider did you see?

```
NotFoundException: Invalid domain name identifier specified
    at getDomain.then.catch (/path/project/node_modules/serverless-domain-manager/index.js:225:13)
    at <anonymous>
    at process._tickDomainCallback (internal/process/next_tick.js:228:7)
From previous event:
    at PluginManager.invoke (/path/project/node_modules/serverless/lib/classes/PluginManager.js:372:22)
    at PluginManager.run (/path/project/node_modules/serverless/lib/classes/PluginManager.js:403:17)
    at variables.populateService.then (/path/project/node_modules/serverless/lib/Serverless.js:102:33)
    at runCallback (timers.js:789:20)
    at tryOnImmediate (timers.js:751:5)
    at processImmediate [as _immediateCallback] (timers.js:722:5)
From previous event:
    at Serverless.run (/path/project/node_modules/serverless/lib/Serverless.js:89:74)
    at serverless.init.then (/path/project/node_modules/serverless/bin/serverless:42:50)
    at <anonymous>

```

Additional Data
---------------

-   ***Serverless Framework Version you're using***: 1.27.2
-   ***Operating System***: macos
-   ***Stack Trace***: above
-   ***Provider Error messages***: ?

Custom deep variables (still) appear not to be correctly resolved
This is a Bug Report
====================

Description
-----------

A follow up to  #4946
(and https://github.com/amplify-education/serverless-domain-manager/issues/124)

For bug reports:

-   What went wrong?\
    My deep custom serverless variables aren't resolved properly.

-   What did you expect should have happened?\
    The variables should be resolved correctly.

-   What was the config you used?\
    Using this config:

Config relevant base part:

```
plugins:
  - serverless-domain-manager

provider:
    stage: ${opt:stage, self:custom.defaultStage}

custom:
  defaultStage: dev

  customDomain:
    domainName: ${self:custom.apiFQDN}
```

and 2 different custom configs:


1)
```
custom
  SLD: mydomain.com
  apiHost: api
  hostPostfix:
    dev: -dev
    staging: -staging
    test: -test
  apiFQDN: ${self:custom.apiHost}${self:custom.hostPostfix.${self:provider.stage}, ''}.${self:custom.SLD}

```

2)
```
custom:
  SLD: mydomain.com
  hostPostfix:
    dev: -dev
    staging: -staging
    test: -test
  apiHost: api${self:custom.hostPostfix.${self:provider.stage}, ''}
  apiFQDN: ${self:custom.apiHost}.${self:custom.SLD}

  
```


The .serverless/serverless-state.json looks good in both variants:

```
"customDomain": {
  "domainName": "api-staging.mydomain.com",
  ...
}
```
But running:

```
sls info --stage staging

```
The CLI output on 1 is
```
Error --------------------------------------------------
 
Error: Domain manager summary logging failed.
Error: Error: 'self:custom.apiHost.self:custom.SLD' could not be found in API Gateway.
NotFoundException: Invalid domain name identifier specified
```

The CLI output on 2 is
```
Error --------------------------------------------------
 
Error: Domain manager summary logging failed.
Error: Error: 'api.mydomain.com' could not be found in API Gateway.
NotFoundException: Invalid domain name identifier specified
```
-   What stacktrace or error message from your provider did you see?

```
NotFoundException: Invalid domain name identifier specified
    at getDomain.then.catch (/path/project/node_modules/serverless-domain-manager/index.js:225:13)
    at <anonymous>
    at process._tickDomainCallback (internal/process/next_tick.js:228:7)
From previous event:
    at PluginManager.invoke (/path/project/node_modules/serverless/lib/classes/PluginManager.js:372:22)
    at PluginManager.run (/path/project/node_modules/serverless/lib/classes/PluginManager.js:403:17)
    at variables.populateService.then (/path/project/node_modules/serverless/lib/Serverless.js:102:33)
    at runCallback (timers.js:789:20)
    at tryOnImmediate (timers.js:751:5)
    at processImmediate [as _immediateCallback] (timers.js:722:5)
From previous event:
    at Serverless.run (/path/project/node_modules/serverless/lib/Serverless.js:89:74)
    at serverless.init.then (/path/project/node_modules/serverless/bin/serverless:42:50)
    at <anonymous>

```

Additional Data
---------------

-   ***Serverless Framework Version you're using***: 1.27.2
-   ***Operating System***: macos
-   ***Stack Trace***: above
-   ***Provider Error messages***: ?