Comments (12)
Would you accept a PR that adds a LIBGRAPHQL_LOCATION
environmental variable to lookup?
from tartiflette.
thanks @Lilja
A dynlib
file is a so
file but for macos, the dynlib file is searched for only if the so one is not found.
The .so file should also be in the /var/task/tartiflette/language/parsers/libgraphqlparser/cffi/ folder, which is where the python are installed as I can see in the error.
Maybe we could provide a way to specify where the libgraphqlparser.so file is instead of only looking for it in the python package. The code that does this here https://github.com/tartiflette/tartiflette/blob/master/tartiflette/language/parsers/libgraphqlparser/parser.py#L35 it may help you understand the problem.
from tartiflette.
Amazing, thanks for your help. I changed our setup and stopped basing our build image in codebuild from ubuntu:20.04
to lambci/lambda:build-python3.8
.
If you are running into this issue in the future, this is what we are building the build image with.
FROM lambci/lambda:build-python3.8
RUN curl --silent --location https://rpm.nodesource.com/setup_14.x | bash - && yum -y install nodejs
RUN yum install -y make git time
RUN curl -sSL https://raw.githubusercontent.com/python-poetry/poetry/master/get-poetry.py | python3 -
ENV PATH "$PATH:/root/.poetry/bin"
RUN npm install -g yarn && \
npm install -g serverless
RUN node --version && \
make --version && \
npm --version && \
yarn --version && \
git --version && \
python3 --version && \
poetry --version && \
sls --version && \
serverless --version && \
time --version
ENTRYPOINT "/bin/bash"
from tartiflette.
Hi,
Seems that tartiflette wasn't installed using pip install tartiflette
(make sure to have the dependencies installed, cmake, bison>=3, flex)).
It's the setup.py file that compile the lib according to the target system.
I do not know how AWS Lambda works, this init step maybe missing.
from tartiflette.
Hmm. Interesting.
I use serverless to package the application. If I download the zip that serverless generates:
It looks like most of these libgraphql
-files are present. But not this .dylib
-file I guess. Is this weird or expected?
from tartiflette.
I added some code to be run before I import tartiflette:
import os
from os import walk
path = "/"
for root, dirs, files in walk(path):
for name in files:
if "libgraphqlparser.so" in name:
print(os.path.abspath(name))
Yeah, it looks like it's not placed as expected? That's strange.
from tartiflette.
@Lilja I'll gladly accept it. I was going to ask you if you wanted to do one :D
from tartiflette.
Hmm. I'm still having issues with this. I tried applying the environmental variable we introduced yesterday. It seems like my prognosis of the file being in /var/task/
was wrong - os.path.abspath()
just prints out the current folder. More debugging leads the fact that is' actually placed where tartiflette actually think it should be?
Here are some logs from cloudwatch:
1st line: printing out os.environ.get()
2nd line: doing the os.walk from the previous script. Also running os.stat
on the file.
To make diffing easier here is me ctrl+f
-ing the paths. They are the same:
The script to check if it exists, etc:
import os
from os import walk
print(f"LIBGRAPHQLPARSER_DIR: {os.environ.get('LIBGRAPHQLPARSER_DIR')}")
for root, dirs, files in walk('./'):
for name in files:
if "libgraphqlparser" in name:
abs_p = os.path.join(os.path.abspath(root), name)
if os.path.exists(abs_p):
print(f"Found libgraphqlparser file '{abs_p}' stat: '{os.stat(abs_p)}'")
Are we suppressing an important OSError
in the parser-file?
from tartiflette.
Added this:
import os
from os import walk
from cffi import FFI
print(f"LIBGRAPHQLPARSER_DIR: {os.environ.get('LIBGRAPHQLPARSER_DIR')}")
a = None
for root, dirs, files in walk('./'):
for name in files:
if "libgraphqlparser" in name:
abs_p = os.path.join(os.path.abspath(root), name)
if os.path.exists(abs_p):
print(f"Found libgraphqlparser file '{abs_p}' stat: '{os.stat(abs_p)}'")
a = abs_p
if a:
_FFI = FFI()
_FFI.dlopen(a)
(/lib64/libstdc++.so.6: version `GLIBCXX_3.4.26' not found)
Hmm. I wonder how to solve it. I have some googling to do.
from tartiflette.
Ho, yes, the except OSError hide the fact that the libgraphqlparser.so file isn't loading due to a missing dependecy
This is because the .so file wasn't compiled for the target it is ran on.
IE. the systeme were you're trying to run the tartiflette lib is not the same as the one you made the "serverless" package for.
on the system you've installed ttftt (where you've done the pip install tartiflette), the so file is compiled and used system wide .so files (like the glibcxx_3.4.26.so one), but once deployed, this libgraphqlparser.so will ask the system for it's .so deps, and in the case of AWS lambda, it doesn't find it cause it is probable that the system running AWS Lambda isn't a GLIB based one or uses a != version.
from tartiflette.
Maybe you can "compile" the libgraphqlparser library for the AWS lambda system, ship it with serverless
and use the ENV var to ask tartiflette to load it.
from tartiflette.
I'm getting the same error when using pipenv
$ pipenv run -- python app.py
Loading .env environment variables...
Traceback (most recent call last):
File "/home/vscode/.local/share/virtualenvs/tartiflette-CpQ0F0WG/lib/python3.9/site-packages/tartiflette/language/parsers/libgraphqlparser/parser.py", line 35, in <module>
_LIB = _FFI.dlopen(f"{_LIBGRAPHQLPARSER_DIR}/libgraphqlparser.so")
File "/home/vscode/.local/share/virtualenvs/tartiflette-CpQ0F0WG/lib/python3.9/site-packages/cffi/api.py", line 150, in dlopen
lib, function_cache = _make_ffi_library(self, name, flags)
File "/home/vscode/.local/share/virtualenvs/tartiflette-CpQ0F0WG/lib/python3.9/site-packages/cffi/api.py", line 832, in _make_ffi_library
backendlib = _load_backend_lib(backend, libname, flags)
File "/home/vscode/.local/share/virtualenvs/tartiflette-CpQ0F0WG/lib/python3.9/site-packages/cffi/api.py", line 827, in _load_backend_lib
raise OSError(msg)
OSError: cannot load library '/home/vscode/.local/share/virtualenvs/tartiflette-CpQ0F0WG/lib/python3.9/site-packages/tartiflette/language/parsers/libgraphqlparser/cffi/libgraphqlparser.so': libstdc++.so.6: cannot open shared object file: No such file or directory. Additionally, ctypes.util.find_library() did not manage to locate a library called '/home/vscode/.local/share/virtualenvs/tartiflette-CpQ0F0WG/lib/python3.9/site-packages/tartiflette/language/parsers/libgraphqlparser/cffi/libgraphqlparser.so'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/workspaces/benchmarks/tartiflette/app.py", line 1, in <module>
from tartiflette import Resolver
File "/home/vscode/.local/share/virtualenvs/tartiflette-CpQ0F0WG/lib/python3.9/site-packages/tartiflette/__init__.py", line 5, in <module>
from tartiflette.engine import Engine
File "/home/vscode/.local/share/virtualenvs/tartiflette-CpQ0F0WG/lib/python3.9/site-packages/tartiflette/engine.py", line 20, in <module>
from tartiflette.execution.collect import parse_and_validate_query
File "/home/vscode/.local/share/virtualenvs/tartiflette-CpQ0F0WG/lib/python3.9/site-packages/tartiflette/execution/collect.py", line 11, in <module>
from tartiflette.language.parsers.libgraphqlparser import parse_to_document
File "/home/vscode/.local/share/virtualenvs/tartiflette-CpQ0F0WG/lib/python3.9/site-packages/tartiflette/language/parsers/libgraphqlparser/__init__.py", line 1, in <module>
from .parser import parse_to_document
File "/home/vscode/.local/share/virtualenvs/tartiflette-CpQ0F0WG/lib/python3.9/site-packages/tartiflette/language/parsers/libgraphqlparser/parser.py", line 37, in <module>
_LIB = _FFI.dlopen(f"{_LIBGRAPHQLPARSER_DIR}/libgraphqlparser.dylib")
File "/home/vscode/.local/share/virtualenvs/tartiflette-CpQ0F0WG/lib/python3.9/site-packages/cffi/api.py", line 150, in dlopen
lib, function_cache = _make_ffi_library(self, name, flags)
File "/home/vscode/.local/share/virtualenvs/tartiflette-CpQ0F0WG/lib/python3.9/site-packages/cffi/api.py", line 832, in _make_ffi_library
backendlib = _load_backend_lib(backend, libname, flags)
File "/home/vscode/.local/share/virtualenvs/tartiflette-CpQ0F0WG/lib/python3.9/site-packages/cffi/api.py", line 827, in _load_backend_lib
raise OSError(msg)
OSError: cannot load library '/home/vscode/.local/share/virtualenvs/tartiflette-CpQ0F0WG/lib/python3.9/site-packages/tartiflette/language/parsers/libgraphqlparser/cffi/libgraphqlparser.dylib': /home/vscode/.local/share/virtualenvs/tartiflette-CpQ0F0WG/lib/python3.9/site-packages/tartiflette/language/parsers/libgraphqlparser/cffi/libgraphqlparser.dylib: cannot open shared object file: No such file or directory. Additionally, ctypes.util.find_library() did not manage to locate a library called '/home/vscode/.local/share/virtualenvs/tartiflette-CpQ0F0WG/lib/python3.9/site-packages/tartiflette/language/parsers/libgraphqlparser/cffi/libgraphqlparser.dylib'
But the lib exists:
$ ls /home/vscode/.local/share/virtualenvs/tartiflette-CpQ0F0WG/lib/python3.9/site-packages/tartiflette/language/parsers/libgraphqlparser/cffi/
__init__.py libgraphqlparser.so __pycache__
I am building on the same machine though so I'm not sure why it can't load it. Any ideas?
from tartiflette.
Related Issues (20)
- Redis HOT 3
- Types generation HOT 5
- ERROR: Failed building wheel for tartiflette HOT 2
- Cross-resolver parameters HOT 1
- [v2] Allow usage of @Resolver on interface fields
- Tartiflette fails to build libgraphqlparser on install HOT 1
- Middlewares? HOT 12
- Exceptions in directives are not handled HOT 1
- Improve performance for I/O bound list resolvers by using parallel execution HOT 15
- forcefully unregister all resolvers for debug purposes HOT 6
- tartiflette.io slack invite link broken HOT 1
- 1.3.3 wheels on pypi are broken HOT 3
- cmake issue while installing on win10 HOT 1
- Setup/teardown is failing when doing automated tests
- Subscription result always `null` - what's the right format to yield? HOT 1
- Error coercers should not wrap custom exceptions inside Tartiflette errors HOT 2
- "poetry add tartiflette" not working
- Incremental delivery support
- ERROR: Failed building wheel for tartiflette
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from tartiflette.