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

RESOLVER_RESOLVE_VARIABLE _ERROR #12471

Open
gavinsui1106 opened this issue May 9, 2024 · 3 comments
Open

RESOLVER_RESOLVE_VARIABLE _ERROR #12471

gavinsui1106 opened this issue May 9, 2024 · 3 comments

Comments

@gavinsui1106
Copy link

Issue description

when i used sls4 to deploy my project,the RESOLVER_RESOLVE_VARIABLE_ERROR is happend in codebuild's log

command
serverless deploy --stage {mystage} --param="division=${envDivision}"

serverless.yml
${self:custom.${opt:stage,self:provider.stage}.XXX}
${file(xxx/serverless_xxx${param:division}.yml)}

what's wrong with my command?

Context

when i used sls4 to deploy my project,the RESOLVER_RESOLVE_VARIABLE_ERROR is happend in codebuild's log

command
serverless deploy --stage {mystage} --param="division=${envDivision}"

serverless.yml
${self:custom.${opt:stage,self:provider.stage}.XXX}
${file(xxx/serverless_xxx${param:division}.yml)}

what's wrong with my command?

@gavinsui1106
Copy link
Author

gavinsui1106 commented May 14, 2024

when i deleted the code "--param="division=${envDivision}"" , so that the deploy command is [serverless deploy --stage ${env}] then other error is happend. but when i use the same code in sls3, its successfully builded!!!

error message
Failed to resolve variable 'custom.${opt:stage' with resolver 'config' :ERROR :Key "custom.${opt:stage" is not defined in config file.

here is my whole code

buildspec.yml

serverless deploy --stage ${env}
#${env} is set with environment during AWS's Coodebuild . for example ,Dev is the value of env.

serverless.yml

provider:
  name: test
  runtime: dotnet6
  region: XXX
  environment: ${file(slsconf/serverless_environment.yml)}

custom:
   ${file(slsconf/serverless_custom${opt: stage, self: provider.stage}.yml)}

slsconf/serverless_environment.yml

TZ: XXX
EnvironmentVariable1: ${self: custom.${opt: stage, self: provider.stage}.EnvironmentVariable1Val}
EnvironmentVariable2: ${self: custom.${opt: stage, self: provider.stage}.EnvironmentVariable2Val}

slsconf/serverless_customDev.yml

EnvironmentVariable1Val: XXX
EnvironmentVariable2Val: XXX

@yeyeric
Copy link

yeyeric commented May 23, 2024

same here, was working great on serverless3 but from today it doesn't work on sls4
it seems the fallback strategy is broken

custom:
  is_async_task_enabled:
    production: true
    other: false
  final_is_async_task_enabled: ${self:custom.is_async_task_enabled.${self:provider.stage}, self:custom.is_async_task_enabled.other}

gives

Error: Failed to resolve variable 'custom.is_async_task_enabled.eric' with resolver 'config' and provider 'self': Error: Key "custom.is_async_task_enabled.eric" is not defined in config file
    at #resolveKey (file:///root/.serverless/releases/4.0.24/package/dist/sf-core.js:989:16542)
    at _ResolverManager.resolve (file:///root/.serverless/releases/4.0.24/package/dist/sf-core.js:989:21362)
    at #handlePlaceholderNode (file:///root/.serverless/releases/4.0.24/package/dist/sf-core.js:989:20310)
    at file:///root/.serverless/releases/4.0.24/package/dist/sf-core.js:989:18471
    at processNodeAndHandleCompletion (file:///root/.serverless/releases/4.0.24/package/dist/sf-core.js:989:137[27](https://gitlab.com/easygy/main/app/-/jobs/6920730129#L27))
    at processNodeAndManagePromise (file:///root/.serverless/releases/4.0.24/package/dist/sf-core.js:989:14363)
    at file:///root/.serverless/releases/4.0.24/package/dist/sf-core.js:989:14180
    at Array.forEach (<anonymous>)
    at processSinks (file:///root/.serverless/releases/4.0.24/package/dist/sf-core.js:989:14135)
    at processGraphInParallel (file:///root/.serverless/releases/4.0.24/package/dist/sf-core.js:989:13978)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async #resolveAndReplacePlaceholders (file:///root/.serverless/releases/4.0.24/package/dist/sf-core.js:989:18188)
    at async _ResolverManager.resolveAndReplacePlaceholdersInConfig (file:///root/.serverless/releases/4.0.24/package/dist/sf-core.js:989:17913)
    at async Object.resolveServiceConfig (file:///root/.serverless/releases/4.0.24/package/dist/sf-core.js:989:[28](https://gitlab.com/easygy/main/app/-/jobs/6920730129#L28)507)
    at async file:///root/.serverless/releases/4.0.24/package/dist/sf-core.js:992:1209
    at async route (file:///root/.serverless/releases/4.0.24/package/dist/sf-core.js:992:1182)```

@gavinsui1106
Copy link
Author

@yeyeric
maybe this error is fixed in 4.0.30,but another error is happened.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants