graphql-compose / graphql-compose/graphql-compose-elasticsearch

Cannot load Elastic API file with available versions

Open
#54 5 comments 0 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
584
Forks
76
PR merge metrics
No merged PRs in 30d

Description

Hi, and thanks so much for this time-saver module!

I have a setup in which I use `graphql-compose-elasticsearch` within an AWS Lambda handler.

When I run it locally with the serverless framework, all works well, but when I deploy the function, I start to get error messages.

The first one was about a wrong parameter passed to the function creating the search() resolver. It was strange, because I used 1:1 the examples from the documentation.

When I deployed a non-minified version of the code, howerver, I received another error:

```json
{
"errorMessage":"Cannot load Elastic API file with avaliable versions from /node_modules/elasticsearch/src/lib/apis/index.js",
"errorType":"Error",
"stackTrace":[
"Function.loadApiListFile (/var/task/src/api/graphql.js:164571:13)",
"Function.findApiVersionFile (/var/task/src/api/graphql.js:164581:42)",
"new ElasticApiParser (/var/task/src/api/graphql.js:164541:121)",
"createSearchResolver (/var/task/src/api/graphql.js:170075:18)",
"composeWithElastic (/var/task/src/api/graphql.js:165022:84)",
"createHandler (/var/task/src/api/graphql.js:262504:111)",
""
]
}
```

I feel I'm getting closer to the problem, because I found #6 where there was a discussion about getting the versions from the Elasticsearch client, rather than the file system.

In a lambda function, I can't rely on the file system or globals (like in containers), because the contained environment the functions live should be stateless.

Is there a specific reason the fix in #6 didn't use the suggestion?

```js
const es = require('elasticsearch');
console.log(es.Client.apis);
```

Maybe the information format which is expected is different?

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.