# Unable to assign a Lambda Layers to a Lambda function

**URL:** <https://forum.serverless.com/t/unable-to-assign-a-lambda-layers-to-a-lambda-function/12103>\
**Category:** Serverless Framework\
**Tags:** aws\
**Created:** [July 25, 2020, 11:08am UTC](https://forum.serverless.com/t/unable-to-assign-a-lambda-layers-to-a-lambda-function/12103 "2020-07-25T11:08:11Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![g0mZy](https://avatars.discourse-cdn.com/v4/letter/g/5daacb/32.png) [@g0mZy](https://forum.serverless.com/u/g0mZy)\
**Post date:** [July 25, 2020, 11:08am UTC](https://forum.serverless.com/t/unable-to-assign-a-lambda-layers-to-a-lambda-function/12103/1 "2020-07-25T11:08:11Z")

</div>

I am trying at create a lambda layer and assigning it to a lambda function, both the layer and function are defined in same serverless.yml file as follows:

> ```
> layers:
> 
> wkhtmltopdfbinary:
> 
> path: wkhtmltopdf-binary
> 
> description: "wkhtnltopdf binary"
> 
> compatibleRuntimes: # optional, a list of runtimes this layer is compatible with
> 
> - python3.6
> 
> - python3.7
> 
> - python3.8
> 
> retain: true
> 
> functions:
> 
> GenerateInspectionReport:
> 
> handler: handler.GenerateInspectionReport
> 
> name: GenerateInspectionReports
> 
> runtime: python3.6
> 
> memorySize: 128 # optional, in MB, default is 1024
> 
> timeout: 600
> 
> # layers: ${self:custom.layer.${self:custom.stage}}
> 
> layers: 
> 
> - { Ref: WkhtmltopdfbinaryLambdaLayer }
> 
> ```

I am getting an error, please help:

```
Error: The CloudFormation template is invalid: Template format error: Unresolved resource dependencies [WkhtmltopdfbinaryLambdaLayer] in the Resources block of the template
      at provider.request.catch.error (D:\Users\gautam\AppData\Roaming\npm\node_modules\serverless\lib\plugins\aws\deploy\lib\validateTemplate.js:20:13)
      at tryCatcher (D:\Users\gautam\AppData\Roaming\npm\node_modules\serverless\node_modules\bluebird\js\release\util.js:16:23)
      at Promise._settlePromiseFromHandler (D:\Users\gautam\AppData\Roaming\npm\node_modules\serverless\node_modules\bluebird\js\release\promise.js:547:31)
      at Promise._settlePromise (D:\Users\gautam\AppData\Roaming\npm\node_modules\serverless\node_modules\bluebird\js\release\promise.js:604:18)
      at Promise._settlePromise0 (D:\Users\gautam\AppData\Roaming\npm\node_modules\serverless\node_modules\bluebird\js\release\promise.js:649:10)
      at Promise._settlePromises (D:\Users\gautam\AppData\Roaming\npm\node_modules\serverless\node_modules\bluebird\js\release\promise.js:725:18)
      at _drainQueueStep (D:\Users\gautam\AppData\Roaming\npm\node_modules\serverless\node_modules\bluebird\js\release\async.js:93:12)
      at _drainQueue (D:\Users\gautam\AppData\Roaming\npm\node_modules\serverless\node_modules\bluebird\js\release\async.js:86:9)
      at Async._drainQueues (D:\Users\gautam\AppData\Roaming\npm\node_modules\serverless\node_modules\bluebird\js\release\async.js:102:5)
      at Immediate.Async.drainQueues [as _onImmediate] (D:\Users\gautam\AppData\Roaming\npm\node_modules\serverless\node_modules\bluebird\js\release\async.js:15:14)
      at runCallback (timers.js:705:18)
      at tryOnImmediate (timers.js:676:5)
      at processImmediate (timers.js:658:5)
      at process.topLevelDomainCallback (domain.js:126:23)

     For debugging logs, run again after setting the "SLS_DEBUG=*" environment variable.

```
