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

Apigee Network call error #161

Open
srinivasmurari opened this issue Nov 1, 2022 · 72 comments
Open

Apigee Network call error #161

srinivasmurari opened this issue Nov 1, 2022 · 72 comments

Comments

@srinivasmurari
Copy link

hi,
when we tried to deploy API proxies using the cicd pipeline we are not able to deploy and got Apigee Network to call error and connection timed out issue,we need to connect via proxy to do any deployments from cicd server we had added proxy in our seetings.xml file and using 2.3.0 maven deploy plugin.

we have tested sample management APIs using bearer token we can make post & get from the same cicd server, but using the plugin we are getting the below-attached issue
deploy command used
mvn clean install -phybrid-apiproxy -Dorg=orgname -Denv=envname -Dbearer=token

Screenshot 2022-11-01 195413

@ssvaidyanathan
Copy link
Collaborator

@srinivasmurari - Looks like the machine where this is running is not able to access apigee.googleapis.com
Can you please confirm the machine can access? Do you need to pass any proxy settings?

@srinivasmurari
Copy link
Author

we can access apigee.googleapis.com from the same machine (we are tested a management API from the machine we have created a target server)
Yes, we have proxy settings, we have added a proxy in our settings.xml, and we are using the 2.3.0 maven plugin.

@ssvaidyanathan
Copy link
Collaborator

Can you share the contents of your settings.xml? Hope you are using "https". Thats the only supported protocol.

If the proxy is setup correctly, you should see something like this in your console output. Can you check your console to see if anything similar is logged?

By the way the latest version is v2.4.3

@srinivasmurari
Copy link
Author

<settings> <localRepository>/root/.m2/repository/</localRepository> <pluginGroups> <pluginGroup>org.apache.maven.plugins</pluginGroup> <pluginGroup>org.codehaus.mojo</pluginGroup> </pluginGroups> <interactiveMode>false</interactiveMode> <offline>false</offline> <mirrors> <mirror> <id>nexus</id> <mirrorOf>*</mirrorOf> <url>file:///root/.m2/repository</url> </mirror> </mirrors> <servers> <server> <id>snapshot</id> <url></url> </server> <server> <id>release</id> <url></url> </server> </servers> <activeProfiles> <!--make the profile active all the time --> <activeProfile>nexus</activeProfile> </activeProfiles> <proxies> <proxy> <id>https_proxy</id> <active>true</active> <protocol>https</protocol> <host>proxyip</host> <port>proxyport</port> <nonProxyHosts></nonProxyHosts> </proxy> </proxies> </settings>
setting.xml

Yes we are using https proxy in setting.xml.
we can see the proxy as per the link above in our console output.
MicrosoftTeams-image (4)

@srinivasmurari
Copy link
Author

Hi @ssvaidyanathan ,

Kindly do the needful, currently, we are blocked at this point. if you need more info let us know.

@ssvaidyanathan
Copy link
Collaborator

@srinivasmurari - I am assuming you have actual proxy host and port in your settings.xml and thats what the log is showing?

If thats true, thats the extent I can help you with. I know other customers using this plugin with the proxy settings and its working for them without issues.

@srinivasmurari
Copy link
Author

Yes, we are using an actual proxy only.
We have tested a management API call with the proxy and it worked fine we can deploy the target server using it.

But when we are trying to use the plugin we are facing issues with the same proxy.

@ssvaidyanathan
Copy link
Collaborator

Are you trying the maven call from the same machine where you tested the Mgmt API?

@srinivasmurari
Copy link
Author

Yes we have tested from the same machine where we are running the maven call

@ssvaidyanathan
Copy link
Collaborator

Just noticed that your proxy settings doesn't have any username password fields? Is that correct? Can you check your machine config to see if the proxy requires any authentication?

@srinivasmurari
Copy link
Author

Yeah, it does not have a username and password.
The proxy doesn't require any authentication.

As we can make management calls from the same machine without authentication that can also conform in 100% that there is no authentication for proxy.

@ssvaidyanathan
Copy link
Collaborator

Are you running the direct Mgmt API calls from your machine and the same machine is failing when called via Maven? Or is it from a build server?

@srinivasmurari
Copy link
Author

Yes we are running mgmnt API calls from the same machine and when called via maven it is failing on the same machine

@ssvaidyanathan
Copy link
Collaborator

ssvaidyanathan commented Nov 5, 2022

You already answered that - My question is - are you trying it in your laptop? If yes, then probably your machine ldap is being passed when you make the direct API call to the proxy from your machine settings. Can you check?

I might have found something in the code but want to be sure before I make that change.

ssvaidyanathan added a commit that referenced this issue Nov 5, 2022
@srinivasmurari
Copy link
Author

No, I am not trying it on my laptop or any personal server. We are trying all the management calls and maven calls in the same Jenkins server.

@ssvaidyanathan
Copy link
Collaborator

I've just released a new version with a fix (v2.4.4)
Will take an hour or so to be available in the Central repo for you to download. Once you see the version here, update your pom to point to this version of the apigee config plugin and re-try. Let me know how it goes.

@ssvaidyanathan
Copy link
Collaborator

Were you able to try?

@srinivasmurari
Copy link
Author

Not yet, as the Jenkins server has no internet connectivity and is hosted in a private network we need to request the required team to get us the plugin's latest version for testing it might take some time but once we can deploy we will let you know

@srinivasmurari
Copy link
Author

@ssvaidyanathan , after installing plugin(config maven plugin :2.4.4, apigee edge maven plugin : 2.3.5 ) in jenkins server we are facing below issue
MicrosoftTeams-image.
in jenkins server we have http client version 4.5.5 maven version 3.6.2 java version 11.0.14.1 .

@ssvaidyanathan
Copy link
Collaborator

For the deploy plugin - can you update your pom to 2.3.4 and try?
Lets first fix the config plugin issue.

@ssvaidyanathan
Copy link
Collaborator

@ssvaidyanathan , after installing plugin(config maven plugin :2.4.4, apigee edge maven plugin : 2.3.5 ) in jenkins server we are facing below issue MicrosoftTeams-image. in jenkins server we have http client version 4.5.5 maven version 3.6.2 java version 11.0.14.1 .

I just tried the deploy plugin (v2.3.5) and it worked for me.

The httpclient jar dependency for this plugin is coming from com.google.http-client:google-http-client-apache:jar:2.0.0
Please check if thats available on your repo

@srinivasmurari
Copy link
Author

we have tried with edge plugin(v2.3.4) and config plugin(v2.4.4), here giving below error like config plugin
MicrosoftTeams-image (1)

the com.google.http-client:google-http-client-apache:jar:2.0.0 plugin is available in the repo
MicrosoftTeams-image (2)

@ssvaidyanathan
Copy link
Collaborator

am not sure - the same error comes with earlier config plugin version? Lets say you use v2.3.0? Did you see it?

@srinivasmurari
Copy link
Author

No with earlier config plugin version we have not seen the same we saw the different error in config plugin version 2.3.0(Apigee network call error)

@ssvaidyanathan
Copy link
Collaborator

ssvaidyanathan commented Nov 8, 2022

There were few releases after that v2,3.0 thst included few fixes, features and also updates to dependency due to vulnerability.Cn you try each version released after 2.3.0 and see which version its starting to cause the issue. Unfortunately thats the only way I can think of

@srinivasmurari
Copy link
Author

srinivasmurari commented Nov 8, 2022

@ssvaidyanathan we are able to deploy target servers and api proxy using Bearer Token
But when we tried to deploy using service account we are facing below issue MicrosoftTeams-image (1)

maven config plugin : 2.4.4 maven deploy plugin : 2.3.5

@ssvaidyanathan
Copy link
Collaborator

ssvaidyanathan commented Nov 8, 2022

So if it worked with the token, it means the proxy issue is fixed with the change? Does it work with the previous version as well? That is using v2.3.4 and passing token, did it work or did the proxy issue return a timeout?

I will look into the issue you reported. But please respond to the above question.

@ssvaidyanathan
Copy link
Collaborator

I just tried deploying the sample sharedflow from the repo using a service account. It worked as expected.
I also tried deleting my .m2/repository directory so that it downloads it freshly. That also worked.

I am using

Java version: 1.8.0_301
Apache Maven: 3.8.4

@srinivasmurari
Copy link
Author

So if it worked with the token, it means the proxy issue is fixed with the change? Does it work with the previous version as well? That is using v2.3.4 and passing token, did it work or did the proxy issue return a timeout?

I will look into the issue you reported. But please respond to the above question.

yes, proxy issue is fixed with the change.

No, We tried with 2.3.4 and by passing a token but the proxy issue returned a timeout

@srinivasmurari
Copy link
Author

ok, we will try to pass the token into the mvn command, meanwhile can you please check, As per our analysis, we are thinking that the plugin is not supporting the proxy, if possible can you add one more if else condition for the below which supports the proxy.
path : src/main/java/com/apigee/edge/config/rest/RestUtil.java
MicrosoftTeams-image (5)
Thanks @ssvaidyanathan

@ssvaidyanathan
Copy link
Collaborator

I'll take a look. Its quite possible

ssvaidyanathan added a commit that referenced this issue Nov 19, 2022
@ssvaidyanathan
Copy link
Collaborator

ssvaidyanathan commented Nov 19, 2022

@srinivasmurari - I have just released a v2.4.5-rc1 with a fix
Since I dont have a corporate proxy setup, I cant really test it. So published a rc version
Can you please remove the deploy plugin from your pipeline and just use the config plugin pointing to the version 2.4.5-rc1 and try? Pass the service account file and see if its working. Please let me know. Once you confirm, I can push an actual version. Until then we can try out with these rc versions.

@srinivasmurari
Copy link
Author

@ssvaidyanathan after using the latest release v2.4.5-rc1 with proxy we are facing the below issue and we have tried with the edge plugin(v2.3.5).

2 4 5-rc1 error

@ssvaidyanathan
Copy link
Collaborator

@srinivasmurari - am not sure why thats coming on your end. That class is available in org/apache/httpcomponents/httpclient/4.5.5 and its a dependency coming from com.google.http-client:google-http-client-apache:jar:2.0.0 which is part of the config plugin pom.xml

When I run mvn dependency:tree on that config plugin pom, I see the following

[INFO] +- com.google.http-client:google-http-client-apache:jar:2.0.0:compile
[INFO] |  \- org.apache.httpcomponents:httpclient:jar:4.5.5:compile

By any chance - in your Maven repo that you are pointing to, is this jar not availabe? Or by any change do you have an <exclusions> section added to your pom where this does not get downloaded?

@srinivasmurari
Copy link
Author

srinivasmurari commented Nov 22, 2022

@ssvaidyanathan we are not sure all the dependencies are available in the local .m2 repository while using 2.4.4 we are getting time out and while using the 2.4.5-rc1 we are getting http- client related issue.
there is no section in our pom.xml.
path org.apache.httpcomponents:httpclient.
MicrosoftTeams-image (6)
path com.google.http-client:google-http-client
MicrosoftTeams-image (7)

@ssvaidyanathan
Copy link
Collaborator

Probably try adding this to your pom under dependencies

<dependency>
  <groupId>org.apache.httpcomponents</groupId>
  <artifactId>httpclient</artifactId>
  <version>4.5.5</version>
</dependency>

@srinivasmurari
Copy link
Author

currently, in our pom.xml under dependencies, we have that httpclient-4.5.5, but we are facing the same error.

@ssvaidyanathan
Copy link
Collaborator

Can you try

<dependency>
  <groupId>org.apache.httpcomponents</groupId>
  <artifactId>httpclient</artifactId>
  <version>4.5.13</version>
</dependency>

@srinivasmurari
Copy link
Author

after adding the dependency 4.5.13 also we are facing the same above error.

@ssvaidyanathan
Copy link
Collaborator

@srinivasmurari - as one last attempt, I just released v2.4.5-rc2 with the httpclient jar as a direct dependency to the plugin. Try that and see. Even if that doesn't work, then generating the token using the script and passing that to the plugin is the only option we are left with.

@ssvaidyanathan
Copy link
Collaborator

any luck?

@srinivasmurari
Copy link
Author

no luck, we have used 2.4.5-rc2 also we are unable to generate the token.
we have directly passed the access token by using the script, and now it is working fine.

@ssvaidyanathan
Copy link
Collaborator

this is not a plugin issue from what I see. Its a network issue.
Is it possible for you to try from your laptop? Just push from your laptop without corporate network

@srinivasmurari
Copy link
Author

as of now, it may not be possible to try from my laptop with the same proxy configuration that we have in our client environment.

@ssvaidyanathan
Copy link
Collaborator

ok.. in that case, I am going to close this issue

@srinivasmurari
Copy link
Author

ok, you can close the issue, thanks for your help.

@ssvaidyanathan
Copy link
Collaborator

@srinivasmurari - if I push a new change (version), will you be able to test it for me pls?

ssvaidyanathan added a commit that referenced this issue Aug 22, 2023
@ssvaidyanathan
Copy link
Collaborator

ssvaidyanathan commented Aug 22, 2023

I just released "v2.4.6-rc1", can you test if you are able to generate the token by just passing the service account file with your Maven proxy setup

@srinivasmurari
Copy link
Author

Hi @ssvaidyanathan ,
we are checking for that using v2.4.6-rc1 and will give you an update once our testing is done.

@ssvaidyanathan
Copy link
Collaborator

Any update?

@ssvaidyanathan
Copy link
Collaborator

@srinivasmurari - do you have any updates on this?

@srinivasmurari
Copy link
Author

Hi @ssvaidyanathan, sorry for the delay in responding, We have completed the setup in the client environment and we have delivered to the client with previous version. now we have explained to them regarding this updated version plugin use as you suggested and we have requested them to provide access to modify the files with an updated version plugin, Currently, we have requested client but the approval is pending.
Once we get the approval from the client we can test in the client environment. Hope you understand.

@ssvaidyanathan
Copy link
Collaborator

@srinivasmurari - I have re-implemented the token generation code and released a version v2.4.6-rc3

Please try using this if you can

@anaik91
Copy link

anaik91 commented Dec 21, 2023

@ssvaidyanathan : one of my customers is facing this issue with 2.5.0 , and they are using http proxy

@ssvaidyanathan
Copy link
Collaborator

@anaik91 - can you please share more details? like logs, the command they are passing. Version used, pom.xml etc

Just mentioning "facing issues", will not be of any help unfortunately.

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