You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If you are behind a firewall/proxy; The lines shown below projects cause failures If you are clonning graddle or maven projects or any other templates during "sam init" command, and building the application through maven(clean install/gradle(gradlew build);
Running helloworld.AppTest
Tests run: 1, Failures: 1, Errors: 0, Skipped: 0, Time elapsed: 0.874 sec <<< FAILURE!
successfulResponse(helloworld.AppTest) Time elapsed: 0.852 sec <<< FAILURE!
java.lang.AssertionError: expected:<200> but was:<500>
at org.junit.Assert.fail(Assert.java:89)
at org.junit.Assert.failNotEquals(Assert.java:835)
at org.junit.Assert.assertEquals(Assert.java:647)
at org.junit.Assert.assertEquals(Assert.java:633)
at helloworld.AppTest.successfulResponse(AppTest.java:13)
sam init, Choose all Option, "Hello World Example", java 8, maven, provide sam-app name (hello-world-example-sam-app),
cd hello-world-example-sam-app/HelloWorldFunction && mvn clean install && cd .. && sam build --template-file template.yaml
Solutions/Work-Arounds: Option - 0:
Comment out/replace the line final String pageContents = this.getPageContents("https://checkip.amazonaws.com"); with the line final String pageContents = "0.1.1.1" // Actual content of the line
Option - 1:
Add the below java contents just before the lines as shown in the links
System.setProperty("https.proxyHost", "<PROXY_SERVER_NAME>");
System.setProperty("https.proxyPort", "<PROXY_PORT_NUMBER>");
Option - 2
Or during maven install invoke as follows;
GoTo Wifi, Check Wifi Settings, Check Proxies, If Proxy Settings is correctly setup, then use the following command to build HelloWorldFuction Project
mvn clean install -Djava.net.useSystemProxies=true
Else Check with System Administrator to get the Proxy Details PROXY_SERVER_NAME and PROXY_PORT_NUMBER
mvn clean install -Dhttps.proxyHost=PROXY_SERVER_NAME -Dhttps.proxyPort=PROXY_PORT_NUMBER
Option - 3
The below option(s) will solve the project build(mvn clean install) and sam build, sam invoke, sam start-api command. No other change required.
The change in the HelloWorldFunction/pom.xml under segments
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<!-- if your system proxy setting is correct(GoTo Wifi, Check Wifi Settings, Check Proxies) -->
<argLine>-Djava.net.useSystemProxies=true</argLine>
</configuration>
</plugin>
</plugins>
**OR**
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<argLine>-Dhttps.proxyHost=PROXY_SERVER_NAME -Dhttps.proxyPort=PROXY_PORT_NUMBER</argLine>
</configuration>
</plugin>
<plugins>```
--------------------------------------------------------------------------------------------------------------
The text was updated successfully, but these errors were encountered:
A Template could be thought to generated at "sam init" command to request developer/user to provide the below information. This can be considered as part of future scope.
We have some similar functionality for other runtimes but some of them have this code (where it gets the IP address) commented out for similar reasons that you listed above.
I think we can apply the same solution here. Feel free to raise a pull request if you are interested.
If you are behind a firewall/proxy; The lines shown below projects cause failures If you are clonning graddle or maven projects or any other templates during "sam init" command, and building the application through maven(clean install/gradle(gradlew build);
aws-sam-cli-app-templates/java8/hello-maven/{{cookiecutter.project_name}}/HelloWorldFunction/src/main/java/helloworld/App.java
Line 29 in 88380eb
T E S T S
How to Reproduce:
Solutions/Work-Arounds:
Option - 0:
Comment out/replace the line
final String pageContents = this.getPageContents("https://checkip.amazonaws.com");
with the line final String pageContents = "0.1.1.1" // Actual content of the lineOption - 1:
Add the below java contents just before the lines as shown in the links
System.setProperty("https.proxyHost", "<PROXY_SERVER_NAME>");
System.setProperty("https.proxyPort", "<PROXY_PORT_NUMBER>");
Option - 2
Or during maven install invoke as follows;
GoTo Wifi, Check Wifi Settings, Check Proxies, If Proxy Settings is correctly setup, then use the following command to build HelloWorldFuction Project
mvn clean install -Djava.net.useSystemProxies=true
Else Check with System Administrator to get the Proxy Details PROXY_SERVER_NAME and PROXY_PORT_NUMBER
mvn clean install -Dhttps.proxyHost=PROXY_SERVER_NAME -Dhttps.proxyPort=PROXY_PORT_NUMBER
Option - 3
The below option(s) will solve the project build(mvn clean install) and sam build, sam invoke, sam start-api command. No other change required.
The change in the HelloWorldFunction/pom.xml under segments
The text was updated successfully, but these errors were encountered: