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

Missing instructions in client examples to start the local server #702

Closed
brentvegafederal opened this issue Dec 16, 2024 · 7 comments
Closed
Labels
area/documentation Improvements or additions to documentation. kind/bug Feature doesn't work as expected.

Comments

@brentvegafederal
Copy link

Question

I'm trying to start an example server or get through some of the examples, but everything end up throwing an error. Any ideas?

swift run --package-path hello-world-urlsession-client-example

...

[138/138] Applying HelloWorldURLSessionClient
Build of product 'HelloWorldURLSessionClient' complete! (21.04s)
Swift/ErrorType.swift:253: Fatal error: Error raised at top level: Client error - cause description: 'Transport threw an error.', underlying error: Could not connect to the server., operationID: getGreeting, operationInput: Input(query: HelloWorldURLSessionClient.Operations.getGreeting.Input.Query(name: nil), headers: HelloWorldURLSessionClient.Operations.getGreeting.Input.Headers(accept: [OpenAPIRuntime.AcceptHeaderContentType<HelloWorldURLSessionClient.Operations.getGreeting.AcceptableContentType>(contentType: HelloWorldURLSessionClient.Operations.getGreeting.AcceptableContentType.json, quality: OpenAPIRuntime.QualityValue(thousands: 1000))])), request: GET /greet [accept: application/json], requestBody: <nil>, baseURL: http://localhost:8080/api, response: <nil>, responseBody: <nil>
swift run --package-path hello-world-async-http-client-example


[1033/1033] Applying HelloWorldAsyncHTTPClient
Build of product 'HelloWorldAsyncHTTPClient' complete! (37.16s)
Swift/ErrorType.swift:253: Fatal error: Error raised at top level: Client error - cause description: 'Transport threw an error.', underlying error: The operation couldn’t be completed. (AsyncHTTPClient.HTTPClient.NWPOSIXError error 1.), operationID: getGreeting, operationInput: Input(query: HelloWorldAsyncHTTPClient.Operations.getGreeting.Input.Query(name: nil), headers: HelloWorldAsyncHTTPClient.Operations.getGreeting.Input.Headers(accept: [OpenAPIRuntime.AcceptHeaderContentType<HelloWorldAsyncHTTPClient.Operations.getGreeting.AcceptableContentType>(contentType: HelloWorldAsyncHTTPClient.Operations.getGreeting.AcceptableContentType.json, quality: OpenAPIRuntime.QualityValue(thousands: 1000))])), request: GET /greet [accept: application/json], requestBody: <nil>, baseURL: http://localhost:8080/api, response: <nil>, responseBody: <nil>
[1]    68970 trace trap  swift run --package-path hello-world-async-http-client-example
@brentvegafederal brentvegafederal added kind/support Adopter support requests. status/triage Collecting information required to triage the issue. labels Dec 16, 2024
@czechboy0
Copy link
Contributor

Thanks @brentvegafederal for reporting this - we somehow forgot to document that you need to spin up e.g. https://github.com/apple/swift-openapi-generator/tree/main/Examples/hello-world-vapor-server-example in a separate tab first.

Would you mind updating that README.md in both the URLSession and AHC example?

@czechboy0 czechboy0 added area/documentation Improvements or additions to documentation. kind/bug Feature doesn't work as expected. and removed status/triage Collecting information required to triage the issue. kind/support Adopter support requests. labels Dec 16, 2024
@czechboy0 czechboy0 changed the title Example Server Errors Missing instructions in client examples to start the local server Dec 16, 2024
@brentvegafederal
Copy link
Author

brentvegafederal commented Dec 17, 2024

I am happy to update the docs, but I'm not quite sure how you want them updated because spinning up Vapor to run the URLSession or AHC example doesn't make sense.

@czechboy0
Copy link
Contributor

It's a pre-requisite of running the client example. We need a server to connect to, and the Vapor and Hummingbird examples are compatible servers you can connect to. We should just mention it there, to avoid confusion of why the client examples don't work out of the box.

@brentvegafederal
Copy link
Author

Ok, got it, I'll add something about it.

@brentvegafederal
Copy link
Author

2 pull requests created (I hope) correctly...

#703
#704

@simonjbeaumont
Copy link
Collaborator

Each of the client examples does include this already:

The server can be started by running any of the Hello World server examples locally.

Is that enough without having to duplicate the information from each of the server examples?

@czechboy0
Copy link
Contributor

Whoops that's my fault, I also missed that line in the README and recommended we add it, sorry.

@czechboy0 czechboy0 closed this as not planned Won't fix, can't repro, duplicate, stale Dec 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/documentation Improvements or additions to documentation. kind/bug Feature doesn't work as expected.
Projects
None yet
Development

No branches or pull requests

3 participants