-
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
Malformed http request URL #5195
Comments
Hey guys, after further debugging i was always to find and patch the bug. The problem was in the The FixToday I used patch-package to patch Here is the diff that solved my problem: diff --git a/node_modules/@graphql-mesh/string-interpolation/cjs/interpolator.js b/node_modules/@graphql-mesh/string-interpolation/cjs/interpolator.js
index b1e0487..4fcdb74 100644
--- a/node_modules/@graphql-mesh/string-interpolation/cjs/interpolator.js
+++ b/node_modules/@graphql-mesh/string-interpolation/cjs/interpolator.js
@@ -99,7 +99,7 @@ class Interpolator {
}
applyRule(str, rule, data = {}) {
const dataToReplace = this.applyData(rule.key, data);
- if (dataToReplace) {
+ if (typeof dataToReplace !== 'undefined') {
return str.replace(rule.replace, this.applyModifiers(rule.modifiers, dataToReplace, data));
}
else if (rule.alternativeText) { This issue body was partially generated by patch-package. ExplanationIn my example My solution was to check if the values Cheers. |
Thanks for opening the issue! |
Issue workflow progress
Progress of the issue based on the
Contributor Workflow
Github,
Stackblitz
or
CodeSandbox
Describe the bug
The graphql-mesh server is making requests with malformed URLs.
To Reproduce Steps to reproduce the behavior:
I cannot provide everything required to reproduce out of the box. Here is the general idea.
I have done a lot of debugging but reached a dead end that may lead into the graphql-mesh codebase.
My mesh server has a openapi-3 source handler that consumes an internal API.
It constructs the schema based on a openapi3-api.json spec. Here is a yaml formatted snippet from that spec file. This is a single http GET route.
It builds, runs and queries! But i have found an edge case which causes the above route to not work as expected.
_
example:
Making this graphql request to the mesh server:
Produces the following http request from the mesh server to the api:
GET /api/v1/nfts/0x9e9c14f909f441bbf0e7a688f7df76e133ee8873/1?chain=1 HTTP/1.1 200 11 - undici
This is perfect! No problem here.
Expected behavior
BUT, the following graphql request is the one in question:
Notice, the only difference between the former and the latter is the tokenId parameter value.
This graphql request produces the following http request from the mesh server to the api:
GET /api/v1/nfts/0x9e9c14f909f441bbf0e7a688f7df76e133ee8873/[THERE SHOULD BE A 0 HERE]?chain=1 HTTP/1.1 200 11 - undici
This http request will always fail because it does not follow the format specified by the openapi-3 spec file.
Furthermore, any requests with tokenId=0 leads to the same url malformation.
Environment:
@graphql-mesh/...
:Additional context
I may post this in the
@graphql-mesh/openapi
repo.The text was updated successfully, but these errors were encountered: