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

Error trying to introspect hasura/openapi #10530

Closed
beddows opened this issue Sep 5, 2024 · 5 comments
Closed

Error trying to introspect hasura/openapi #10530

beddows opened this issue Sep 5, 2024 · 5 comments

Comments

@beddows
Copy link

beddows commented Sep 5, 2024

Component

c/v3-cli, c/v3-ndc-openapi

What is the current behaviour?

When running the following:

ddn supergraph init .

6:45PM INF Created file "hasura.yaml"
6:45PM INF Created file "supergraph.yaml"
6:45PM INF Created file ".env"
6:45PM INF Created file "compose.yaml"
6:45PM INF Created directory "engine"
6:45PM INF Created file "engine/.env.engine"
6:45PM INF Created file "otel-collector-config.yaml"
6:45PM INF Created file ".gitignore"
6:45PM INF Created file ".gitattributes"
6:45PM INF Created directory ".vscode"
6:45PM INF Created file ".vscode/launch.json"
6:45PM INF Created file ".vscode/extensions.json"
6:45PM INF Created file ".vscode/tasks.json"
6:45PM INF Created directory ".devcontainer"
6:45PM INF Created file ".devcontainer/devcontainer.json"
6:45PM INF Created directory "globals"
6:45PM INF Created file "globals/subgraph.yaml"
6:45PM INF Created file "globals/auth-config.hml"
6:45PM INF Created file "globals/compatibility-config.hml"
6:45PM INF Created file "globals/graphql-config.hml"
6:45PM INF Created directory "engine/build"
6:45PM INF Created file "engine/build/auth_config.json"
6:45PM INF Created file "engine/build/open_dd.json"
6:45PM INF Created file "engine/build/metadata.json"
6:45PM INF Created directory "app"
6:45PM INF Created file "app/subgraph.yaml"
6:45PM INF Created file ".hasura/context.yaml"
6:45PM INF Key "subgraph" set to "app/subgraph.yaml" in the context.
6:45PM INF Key "supergraph" set to "supergraph.yaml" in the context.
6:45PM INF Key "localEnvFile" set to ".env" in the context.
6:45PM INF Supergraph initialized in directory "." successfully
6:45PM INF A Subgraph "globals" was created with the supergraph-level metadata objects.
6:45PM INF A Subgraph "app" was created to get you started with building your API.
HINT Add a Connector to the Subgraph: ddn connector init -i

ddn connector init my_connector -i

6:45PM INF Using Subgraph "app/subgraph.yaml" found in context.
? Hub Connector hasura/openapi
? Port 4502
Provide the env vars for the connector. Press enter to use the default value or if no default is available, then nil value
? NDC_OAS_DOCUMENT_URI (The URI of OAS Document. If not provided, the connector will look for
`/etc/connector/swagger.json` by default) ./trilium.yaml
? NDC_OAS_BASE_URL (Base url of the API) http://localhost:8080/etapi
? NDC_OAS_LAMBDA_PRETTY_LOGS (Print logs in a human readable format instead of JSON) true
? NDC_OAS_FILE_OVERWRITE (Overwrite previously generated functions.ts file and api.ts file) false
7:05PM INF Using localEnvFile ".env" found in context.
7:05PM INF Created directory "app/connector/my_connector"
7:05PM INF Created file "app/connector/my_connector/connector.yaml"
7:05PM INF Created file "app/connector/my_connector/compose.yaml"
7:05PM INF Created file "app/connector/my_connector/.ddnignore"
7:05PM INF Created file "app/metadata/my_connector.hml"
7:05PM INF Connector URLs added to env file ".env" successfully
7:05PM INF Connector "my_connector" initialized in Subgraph "app" successfully
HINT Introspect data source: ddn connector introspect my_connector

ERROR: ddn connector introspect my_connector

7:06PM INF Using Subgraph "app/subgraph.yaml" found in context.
7:06PM INF Using localEnvFile ".env" found in context.
[23:06:50.421] FATAL (1): Cannot create property 'info' on string 'error while fetching data from URL ""'
err: {
"type": "TypeError",
"message": "Cannot create property 'info' on string 'error while fetching data from URL ""'",
"stack":
TypeError: Cannot create property 'info' on string 'error while fetching data from URL ""'
at /app/node_modules/swagger-typescript-api/src/swagger-schema-resolver.js:71:19
at new Promise ()
at SwaggerSchemaResolver.convertSwaggerObject (/app/node_modules/swagger-typescript-api/src/swagger-schema-resolver.js:69:12)
at SwaggerSchemaResolver.create (/app/node_modules/swagger-typescript-api/src/swagger-schema-resolver.js:59:23)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async CodeGenProcess.start (/app/node_modules/swagger-typescript-api/src/code-gen-process.js:86:21)
at async Object.generateApi (/app/node_modules/swagger-typescript-api/src/index.js:21:12)
at async Object.generateApiTsCode (/app/dist/app/generator/api-ts-generator.js:46:34)
at async Object.generateCode (/app/dist/app/generator/index.js:35:23)
at async Object.runApp (/app/dist/app/index.js:44:27)
}
Cannot create property 'info' on string 'error while fetching data from URL ""'
7:06PM ERR introspect failed with error: exit status 1

The image ghcr.io/hasura/ndc-open-api-lambda:v0.1.2 is in Docker.

What is the expected behaviour?

Expected the introspection to complete.

How to reproduce the issue?

I've tried this with several validated OpenAPI specs, same error. Using macOS Sonoma 14.5, Docker Desktop 4.34.0.

@beddows beddows added the k/v3-bug Bug affecting Hasura v3 (DDN) label Sep 5, 2024
@m-Bilal
Copy link
Member

m-Bilal commented Sep 6, 2024

@beddows Hi! Thank you for reporting this. Can you please point me to any OpenAPI Document URL that gives you this error?

@beddows
Copy link
Author

beddows commented Sep 6, 2024

@m-Bilal Apologies, I should have attached it. Please rename to yaml.

trilum.txt

@m-Bilal
Copy link
Member

m-Bilal commented Sep 9, 2024

Found the issue! It's here:

NDC_OAS_DOCUMENT_URI (The URI of OAS Document. If not provided, the connector will look for
/etc/connector/swagger.json by default) ./trilium.yaml

What's happening here, is that this file (trilium.yaml) is not being mounted to the container as swagger.json. If you want the connector to the OpenAPI Spec from a file, it must be named swagger.json, and it must be mounted to /etc/connector/. Otherwise, the connector will expect a URL from which it can fetch the OpenAPI Spec.

@m-Bilal
Copy link
Member

m-Bilal commented Sep 9, 2024

@beddows let me know please if the explanation helps with the fix

@m-Bilal m-Bilal removed k/v3-bug Bug affecting Hasura v3 (DDN) c/v3-cli labels Sep 10, 2024
@linear linear bot closed this as not planned Won't fix, can't repro, duplicate, stale Sep 10, 2024
@beddows
Copy link
Author

beddows commented Sep 13, 2024

@m-Bilal Just seeing this now, will try it out. Thanks!

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

3 participants