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

Lab no. 7 : Azure app not the calling APIs #43

Closed
husseinsa opened this issue Feb 7, 2024 · 5 comments
Closed

Lab no. 7 : Azure app not the calling APIs #43

husseinsa opened this issue Feb 7, 2024 · 5 comments

Comments

@husseinsa
Copy link
Collaborator

husseinsa commented Feb 7, 2024

Hi @chtrembl
I am using this project to introduce Azure to our folks.

When following lab no. 7, I updated the Application Settings "PETSTOREPETSERVICE_URL" to point to the public IP of Ingress controller:

image

However, when I browse the App, and navigate to "Shop by breeds", it doesn't work:
image

Troubleshooting:

  1. Accessing the API through external ingress IP is working fine:

image

  1. Trying to access the same API endpoint got when accessing "Shop by breeds":

curl -v http://20.246.239.92/petstorepetservice/v2/pet/findByStatus?status=available

Trying 20.246.239.92:80...
 * TCP_NODELAY set
 * Connected to 20.246.239.92 (20.246.239.92) port 80 (#0)
 > GET /petstorepetservice/v2/pet/findByStatus?status=available HTTP/1.1
 > Host: 20.246.239.92
 > User-Agent: curl/7.68.0
 > Accept: */*
 >
 * Mark bundle as not supporting multiuse
 < HTTP/1.1 501
 < Date: Wed, 07 Feb 2024 20:17:18 GMT
 < Content-Length: 0
 < Connection: keep-alive
 <
 * Connection #0 to host 20.246.239.92 left intact

@chtrembl
Copy link
Owner

chtrembl commented Feb 8, 2024

Thanks for reaching out @husseinsa and glad to see your using Azure Pet Store.

Can you please try adding the following 4 config properties

PETSTOREPETSERVICE_URL=[your ip for ingress]
PETSTORESERVICES_SUBSCRIPTION_KEY=blank
PETSTORE_APIM_HOST=blank

I'm wondering if I introduced a dependency on these APIM params that do not come up until a later guide. If this works please let me know and I will update this guide.

@husseinsa
Copy link
Collaborator Author

husseinsa commented Feb 8, 2024

@chtrembl This is not the issue, since this endpoint petstorepetservice/v2/pet/findByStatus?status=available doesn't work locally (running containers) or an azure (running on kubernetes)

501 error when passing the status
image

However, when removing the status, it complains about missing parameters which means its hitting the API
image
We see the same behavior when trying it against ingress IP.

I am wondering now why the application is working locally but not on Azure. Is the app hitting different endpoint that we are not aware of.

I've tried adding the parameters you mentioned above, and it didnt work.

@chtrembl
Copy link
Owner

chtrembl commented Feb 9, 2024

I was able to reproduce the 400 errors and made a fix that should be all set with the latest commit, as mentioned I reproduced the 400 errors, not sure on that 501, looks like an extra slash in the above screenshot ":8081//"

Please pull latest commit

The "HOST" header is now a conditional header and only set when PETSTORE_APIM_HOST is present (not needed until guide 9, didn't realize this was breaking the NGINX ingress, thanks for pointing this out, I should write some regression tests :) )

make sure your application.yml still has the petstore.apim.host property commented out (it should be by default until guide 9)

from your local machine if you can still get a 200 from the following: (looks like the cluster is stopped when I tried with yours)

curl -H "Content-Type: application/json" http://20.246.239.92/petstorepetservice/v2/pet/findByStatus\?status\=available

then try:
docker build -t petstoreapp .
docker run --rm --name petstoreapp -p 8080:8080 -e PETSTOREAPP_SERVER_PORT=8080 -e PETSTOREPETSERVICE_URL=http://20.246.239.92/ petstoreapp:latest

Azure App Service set:

PETSTOREAPP_SERVER_PORT=8080
PETSTOREPETSERVICE_URL=http://20.246.239.92/
PETSTOREPRODUCTSERVICE_URL=http://20.246.239.92/
PETSTOREORDERSERVICE_URL=http://20.246.239.92/

Please keep me posted. Thanks.

@husseinsa
Copy link
Collaborator Author

husseinsa commented Feb 9, 2024

It's working now. Thanks!
There is another issue in the ci/cd lab for the kubernetes. If you can give me permissions, i can push the new fix and create a PR.

@chtrembl
Copy link
Owner

chtrembl commented Feb 9, 2024

Thanks for assisting @husseinsa, you are now a collaborator, welcome aboard!. Please submit a PR.

@chtrembl chtrembl closed this as completed Feb 9, 2024
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