Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AST error in generate client when using ClientForwardRefsPlugin #324

Open
akshats1998 opened this issue Oct 31, 2024 · 0 comments
Open

AST error in generate client when using ClientForwardRefsPlugin #324

akshats1998 opened this issue Oct 31, 2024 · 0 comments

Comments

@akshats1998
Copy link

akshats1998 commented Oct 31, 2024

Hey! Currently when we import AriadneClient, it takes up about 400MB due to all the types, schemas. TO solve this we were hoping to use ClientForwardRefPlugin. However, on doing ariadne-codegen after setting the plugin we're getting the following error

Plugins to use: ariadne_codegen.contrib.no_reimports.NoReimportsPlugin,ariadne_codegen.contrib.client_forward_refs.ClientForwardRefsPlugin
Traceback (most recent call last):
  File "/Users/akshat/doppel/backend/functions/venv/bin/ariadne-codegen", line 8, in <module>
    sys.exit(main())
  File "/Users/akshat/doppel/backend/functions/venv/lib/python3.9/site-packages/click/core.py", line 1130, in __call__
    return self.main(*args, **kwargs)
  File "/Users/akshat/doppel/backend/functions/venv/lib/python3.9/site-packages/click/core.py", line 1055, in main
    rv = self.invoke(ctx)
  File "/Users/akshat/doppel/backend/functions/venv/lib/python3.9/site-packages/click/core.py", line 1404, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/Users/akshat/doppel/backend/functions/venv/lib/python3.9/site-packages/click/core.py", line 760, in invoke
    return __callback(*args, **kwargs)
  File "/Users/akshat/doppel/backend/functions/venv/lib/python3.9/site-packages/ariadne_codegen/main.py", line 37, in main
    client(config_dict)
  File "/Users/akshat/doppel/backend/functions/venv/lib/python3.9/site-packages/ariadne_codegen/main.py", line 81, in client
    generated_files = package_generator.generate()
  File "/Users/akshat/doppel/backend/functions/venv/lib/python3.9/site-packages/ariadne_codegen/client_generators/package.py", line 171, in generate
    self._generate_client()
  File "/Users/akshat/doppel/backend/functions/venv/lib/python3.9/site-packages/ariadne_codegen/client_generators/package.py", line 259, in _generate_client
    ast_to_str(client_module, multiline_strings=True), self.queries_source
  File "/Users/akshat/doppel/backend/functions/venv/lib/python3.9/site-packages/ariadne_codegen/utils.py", line 27, in ast_to_str
    code = ast.unparse(ast_obj)
  File "/opt/homebrew/Cellar/[email protected]/3.9.19/Frameworks/Python.framework/Versions/3.9/lib/python3.9/ast.py", line 1572, in unparse
    return unparser.visit(ast_obj)
  File "/opt/homebrew/Cellar/[email protected]/3.9.19/Frameworks/Python.framework/Versions/3.9/lib/python3.9/ast.py", line 801, in visit
    self.traverse(node)
  File "/opt/homebrew/Cellar/[email protected]/3.9.19/Frameworks/Python.framework/Versions/3.9/lib/python3.9/ast.py", line 795, in traverse
    super().visit(node)
  File "/opt/homebrew/Cellar/[email protected]/3.9.19/Frameworks/Python.framework/Versions/3.9/lib/python3.9/ast.py", line 407, in visit
    return visitor(node)
  File "/opt/homebrew/Cellar/[email protected]/3.9.19/Frameworks/Python.framework/Versions/3.9/lib/python3.9/ast.py", line 816, in visit_Module
    self._write_docstring_and_traverse_body(node)
  File "/opt/homebrew/Cellar/[email protected]/3.9.19/Frameworks/Python.framework/Versions/3.9/lib/python3.9/ast.py", line 809, in _write_docstring_and_traverse_body
    self.traverse(node.body)
  File "/opt/homebrew/Cellar/[email protected]/3.9.19/Frameworks/Python.framework/Versions/3.9/lib/python3.9/ast.py", line 793, in traverse
    self.traverse(item)
  File "/opt/homebrew/Cellar/[email protected]/3.9.19/Frameworks/Python.framework/Versions/3.9/lib/python3.9/ast.py", line 795, in traverse
    super().visit(node)
  File "/opt/homebrew/Cellar/[email protected]/3.9.19/Frameworks/Python.framework/Versions/3.9/lib/python3.9/ast.py", line 407, in visit
    return visitor(node)
  File "/opt/homebrew/Cellar/[email protected]/3.9.19/Frameworks/Python.framework/Versions/3.9/lib/python3.9/ast.py", line 846, in visit_ImportFrom
    self.write("." * node.level)
    TypeError: can't multiply sequence by non-int of type 'NoneType'
    ```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant