You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Other endpoints for this server have worked successfully. My hypothesis is that the error is triggered when the response content encoding is compressed (gzip or deflate). It seems that the error is caused by using an out-of-date version of the undici npm module per this defect and should be fixed as of v6.21.0. npm version on the data connector container shows that undici v5.28.4 is being used. Since the package requirement originates in the ndc lambda sdk that project might need to be updated first.
However, I tried reproducing this error by modifying a sample OpenAPI server in Rust but I got a different internal error, regardless of whether the response was delivered compressed. This was the error:
ddn connector introspect myopenapi fails when NDC_OAS_DOCUMENT_URI is set to http://localhost:55555/api-docs/openapi.json (presumably because fetch fails for retrieving the swagger file too)
ddn connector introspect myopenapi yields the following: "Error: overwriting is disabled and api.ts file already exists at /etc/connector/api.ts. To enable file overwrite, please set 'NDC_OAS_FILE_OVERWRITE' environment variable to
true, or use the --overwrite flag". However, ddn connector introspect myopenapi --overwrite gives us "ERR unknown flag: --overwrite". Changing the environment variable does work, but the first error message should not suggest using a command line flag that does not exist.
What is the expected behaviour?
The query should complete without error (regardless of whether compression is being used). In the sample steps below, to run with compression, replace step 3 with cargo run gzip &
How to reproduce the issue?
I modified a sample Rust OpenAPI server for testing purposes. The steps below build and run that server, build a supergraph to connect to the server, and try querying an endpoint.
Clone the sample repo: git clone https://github.com/durkino/hasura-fetch-example.git
cd hasura-fetch-example
Build and run the server in the background. cargo run &
Confirm the server is working. curl http://localhost:55555/helloworld and curl http://localhost:55555/api-docs/openapi.json
mkdir ../supergraph
cd ../supergraph
ddn supergraph init .
ddn connector init -i
Pick the hasura/openapi connector.
Leave everything default except NDC_OAS_BASE_URL should be set to http://localhost:55555
Copy down the swagger file. curl http://localhost:55555/api-docs/openapi.json > app/connector/myopenapi/swagger.json
ddn connector introspect myopenapi
ddn command add myopenapi "*"
ddn supergraph build local
ddn console --local
ddn run docker-start
In the GraphiQL console in your browser try the getHelloworldHelloworld query and observe the internal error.
Cleanup the Rust server running in the background by killing the process (from step 3)
Keywords
fetch
undici
openapi data connector
The text was updated successfully, but these errors were encountered:
Component
c/v3-ndc-open-api-lambda
What is the current behaviour?
I have been trying to use the OpenAPI data connector to connect to an internal server, but I get the following error:
Other endpoints for this server have worked successfully. My hypothesis is that the error is triggered when the response content encoding is compressed (gzip or deflate). It seems that the error is caused by using an out-of-date version of the
undici
npm module per this defect and should be fixed as of v6.21.0.npm version
on the data connector container shows that undici v5.28.4 is being used. Since the package requirement originates in the ndc lambda sdk that project might need to be updated first.However, I tried reproducing this error by modifying a sample OpenAPI server in Rust but I got a different internal error, regardless of whether the response was delivered compressed. This was the error:
Side notes:
ddn connector introspect myopenapi
fails whenNDC_OAS_DOCUMENT_URI
is set tohttp://localhost:55555/api-docs/openapi.json
(presumably because fetch fails for retrieving the swagger file too)ddn connector introspect myopenapi
yields the following: "Error: overwriting is disabled and api.ts file already exists at /etc/connector/api.ts. To enable file overwrite, please set 'NDC_OAS_FILE_OVERWRITE' environment variable totrue, or use the --overwrite flag". However,
ddn connector introspect myopenapi --overwrite
gives us "ERR unknown flag: --overwrite". Changing the environment variable does work, but the first error message should not suggest using a command line flag that does not exist.What is the expected behaviour?
The query should complete without error (regardless of whether compression is being used). In the sample steps below, to run with compression, replace step 3 with
cargo run gzip &
How to reproduce the issue?
I modified a sample Rust OpenAPI server for testing purposes. The steps below build and run that server, build a supergraph to connect to the server, and try querying an endpoint.
git clone https://github.com/durkino/hasura-fetch-example.git
cd hasura-fetch-example
cargo run &
curl http://localhost:55555/helloworld
andcurl http://localhost:55555/api-docs/openapi.json
mkdir ../supergraph
cd ../supergraph
ddn supergraph init .
ddn connector init -i
NDC_OAS_BASE_URL
should be set tohttp://localhost:55555
curl http://localhost:55555/api-docs/openapi.json > app/connector/myopenapi/swagger.json
ddn connector introspect myopenapi
ddn command add myopenapi "*"
ddn supergraph build local
ddn console --local
ddn run docker-start
getHelloworldHelloworld
query and observe the internal error.Keywords
fetch
undici
openapi data connector
The text was updated successfully, but these errors were encountered: