# Direct file reference for creating lambda

**URL:** <https://forum.serverless.com/t/direct-file-reference-for-creating-lambda/18193>\
**Category:** Serverless Framework\
**Tags:** lambda\
**Created:** [January 12, 2023, 8:55pm UTC](https://forum.serverless.com/t/direct-file-reference-for-creating-lambda/18193 "2023-01-12T20:55:49Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![anishgeorgek](https://yyz2.discourse-cdn.com/flex036/user_avatar/forum.serverless.com/anishgeorgek/32/7241_2.png) [@anishgeorgek](https://forum.serverless.com/u/anishgeorgek)\
**Post date:** [January 12, 2023, 8:55pm UTC](https://forum.serverless.com/t/direct-file-reference-for-creating-lambda/18193/1 "2023-01-12T20:55:50Z")

</div>

Hello,

In my serverless.yml template I am trying to create a lambda function by directly referring the ‘js’ file as shown below. This is not working as expected due to error ‘Configuration error at ‘functions.function1.handler’: must be string’ . Requesting help to find out what is the error here.

* * *

service: proj3  
configValidationMode: error

frameworkVersion: ‘3’

provider:  
name: aws  
runtime: nodejs12.x  
stage: dev

package:  
patterns:  
- ‘!node\_modules/**’  
- '!src/**’  
- ‘src/func1/handler.js’

functions:  
function1:  
name: function1  
description: This is function 1  
handler: “${file(src/func1/handler.js):func1}”

* * *
