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

service not found while using api gateway #2587

Closed
leoujz opened this issue Nov 2, 2022 · 7 comments
Closed

service not found while using api gateway #2587

leoujz opened this issue Nov 2, 2022 · 7 comments

Comments

@leoujz
Copy link
Contributor

leoujz commented Nov 2, 2022

request: http://localhost:8080/helloworld/call
response: {"id":"go.micro.api","code":500,"detail":"service not found","status":"Internal Server Error"}

The Detailed reproducing step are posted in the issue in go-micro/api repository

Am I missing some steps or config?

@Davincible
Copy link
Contributor

Hmm I'm not exactly sure, haven't used the API a lot.

The service not found would be a registry issue. Either not calling the correct service, or the service has not been registered.

You could try to use the client code, instead of cli,

@leoujz
Copy link
Contributor Author

leoujz commented Nov 2, 2022

I might need some hints on how to run go-micro/api, the api gateway, according to README of go-micro/api, just install and run it, without any steps / configuration / codes on service side

@leoujz
Copy link
Contributor Author

leoujz commented Nov 9, 2022

After some debugging, I have figured out that registering endpoints manually by code might be the necessary step, because when handling the request it will try to first match the endpoints of the default router, and then go to another way to resolve the service name and endpoint name, and in this process it use the METHOD value as the endpoint name, then report some error. (for service not found error, it resolve the service name as go.micro.helloworld)
In my opinion, manually registering endpoints to the router would be a little tedious, because service and endpoint are already assigned in the HTTP request, auto resolving them would be a better way

@leoujz
Copy link
Contributor Author

leoujz commented Nov 9, 2022

I think this issue can be closed now.

@Davincible
Copy link
Contributor

I am glad you managed to find a solution. I agree that auto registration would be best.
Apologies for not giving you a better solution right now, most of our efforts are currently focused on v5.

If you ever find some time to dig into it contributions would be very welcome.

@leoujz
Copy link
Contributor Author

leoujz commented Nov 9, 2022

It does not matter, thanks for your efforts on go-micro, really great repo. I will try to commit a pull request

@leoujz
Copy link
Contributor Author

leoujz commented Nov 9, 2022

solve it with fixing endpoint name extraction when no endpoint matched, see #2592

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

2 participants