-
Notifications
You must be signed in to change notification settings - Fork 349
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
[v1] Can't use top-level await in mesh.config.*
#7342
Comments
You should not use Serve CLI with lambdas. |
We are indeed using serve runtime for the lambda but are building the supergraph with the compose CLI. Jiti is being included in serve-runtime as well due to being used in the utils package. I can send an example bundle metafile that you can inspect later There are a bunch of packages that are required to be bundled despite not being used (eg Hive stuff) and I tried to see if I could improve that but it would require making createServeRuntime async so I gave up But this issue is specifically about the transforming of the config file breaking using top level awaits when they should be possible |
Oh ok you're right. JITI should not be there already. |
@ardatan This issue was about top-level await not being usable in the config files, and it is still not possible |
hey @beeequeue, jiti is no longer used in utils which is what #7360 had done closing this issue. Furthermore, Maybe you're facing this issue while using compose-cli? |
Yes, we're using a config file for composing our schema before deploying said schema with a lambda running However the old config from before jiti no longer works due to some required top-level awaits that should work. The issue is about this, while the jiti-in-bundle was just another problem I found |
Gotcha! Is the compose config in TS or JS? Asking because a flag like |
The config is in TS, changing it to Optimally jiti would just transform the file to the correct ESM/CJS format based on the |
Sadly because of unjs/jiti#72 (comment), I dont think jiti will support transformations to ESM any time soon. I can have a |
It would work, yes. |
Ok cool, can you try the alpha compose-cli release and use the
|
It works 🙂 |
Great, thanks for helping out! |
Issue workflow progress
Progress of the issue based on the
Contributor Workflow
Github,
Stackblitz
or
CodeSandbox
Describe the bug
After switching to
jiti
for loadingmesh.config.*
it's no longer possible to use top-level awaits due to it converting the file to some format that doesn't allow it.Not even
.mjs
allows it, presumably because it's being formatted to CJS.To Reproduce Steps to reproduce the behavior:
Try to use a top-level await in a mesh config when it should be possible (ESM package)
Expected behavior
It should work
Environment:
@graphql-mesh/...
: v1 alphaAdditional context
Jiti also has some other issues like bundling babel leading to our lambda bundle going from 1.7MB to 3MB after it was added.
The text was updated successfully, but these errors were encountered: