# Absolute paths in lambda functions?

**URL:** <https://answers.netlify.com/t/absolute-paths-in-lambda-functions/3436>\
**Category:** Support\
**Tags:** lambda-functions\
**Created:** [September 13, 2019, 12:05am UTC](https://answers.netlify.com/t/absolute-paths-in-lambda-functions/3436 "2019-09-13T00:05:35Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![codebuddies\_admin](https://avatars.discourse-cdn.com/v4/letter/c/c68b51/32.png) [@codebuddies\_admin](https://answers.netlify.com/u/codebuddies_admin)\
**Post date:** [September 13, 2019, 12:05am UTC](https://answers.netlify.com/t/absolute-paths-in-lambda-functions/3436/1 "2019-09-13T00:05:35Z")

</div>

I am having a hard time deploying my lambda functions using Netlify. You can find my source code [here](https://github.com/codebuddies/serverless-concept/tree/develop/src/lambda). Everything works perfectly fine when I run it locally via `ntl dev`. However, once I deploy it, it appears the absolute paths to my files don’t seem to be right?

I am using **path.join(\_\_dirname)** to get the absolute path from where I want to find my schema type files and resolvers like [so](https://github.com/codebuddies/serverless-concept/blob/develop/src/lambda/types/index.js#L3). Again, everything works just fine locally but fails to find my files since once deployed since the path according to the logs point to `var/task/src/lambda/types`?

Below are the errors in the console:

```auto
5:54:28 PM: graphql invoked
5:54:28 PM: types dir: /var/task/src/lambda/types
5:54:28 PM: typeDefs: "schema {\n query: Query\n}\n"
5:54:28 PM: {"errorMessage":"Unknown type \"Query\".","errorType":"Error","stackTrace":["assertValidSDL (/var/task/node_modules/graphql/validation/validate.js:108:11)","Object.buildASTSchema (/var/task/node_modules/graphql/utilities/buildASTSchema.js:71:34)","Object.buildSchemaFromTypeDefinitions (/var/task/node_modules/graphql-tools/dist/generate/buildSchemaFromTypeDefinitions.js:23:28)","Object.makeExecutableSchema (/var/task/node_modules/graphql-tools/dist/makeExecutableSchema.js:26:29)","ApolloServer.initSchema (/var/task/node_modules/apollo-server-core/dist/ApolloServer.js:272:49)","new ApolloServerBase (/var/task/node_modules/apollo-server-core/dist/ApolloServer.js:202:30)","new ApolloServer (/var/task/node_modules/apollo-server-lambda/dist/ApolloServer.js:21:9)","Object.exports.initialize (/var/task/lib/apollo.js:21:18)","module.exports (/var/task/initializers/apollo.initializer.js:8:10)","Object.exports.run (/var/task/initializers/setup.js:4:3)"]}
XRAY TraceId: 1-5d7adab4-68fd15e0267321c011a9d000	SegmentId: 4e71066a7ddc4fa9	Sampled: false

```

Apollo craps out because it can’t find a valid Query type since it failed to find and load in my `.graphql` files.

Any ideas? I’m sure I am missing something obvious here but been banging my head ☹

---

<div class="post-metadata">

**Author:** ![codebuddies\_admin](https://avatars.discourse-cdn.com/v4/letter/c/c68b51/32.png) [@codebuddies\_admin](https://answers.netlify.com/u/codebuddies_admin)\
**Post date:** [September 14, 2019, 5:13pm UTC](https://answers.netlify.com/t/absolute-paths-in-lambda-functions/3436/2 "2019-09-14T17:13:32Z")

</div>

I took a different approach in how to import my schema files to ensure they’re included in my bundled function and now my graphql endpoint works!

---

<div class="post-metadata">

**Author:** ![futuregerald](https://sea1.discourse-cdn.com/netlify/user_avatar/answers.netlify.com/futuregerald/32/33_2.png) [@futuregerald](https://answers.netlify.com/u/futuregerald)\
**Post date:** [September 23, 2019, 1:32pm UTC](https://answers.netlify.com/t/absolute-paths-in-lambda-functions/3436/3 "2019-09-23T13:32:18Z")

</div>

That’s great to hear, @codebuddies_admin!
