Connection was closed before we received a valid response from endpoint URL

0

I am following IoT Greengrass tutorial - https://docs.aws.amazon.com/greengrass/v2/developerguide/defer-component-updates-tutorial.html. I am stuck on the step "gdk component publish". I am unable to publish the helloworld component to cloud service from my development computer.

Issue


[2023-03-01 20:38:54] INFO - Getting project configuration from gdk-config.json [2023-03-01 20:38:54] INFO - Found component recipe file 'recipe.json' in the project directory. [2023-03-01 20:38:54] INFO - Found credentials in shared credentials file: ~/.aws/credentials [2023-03-01 20:39:10] ERROR - Failed to calculate the version of component 'com.example.BatteryAwareHelloWorld' based on the configuration. [2023-03-01 20:39:10] ERROR - Failed to publish new version of the component 'com.example.BatteryAwareHelloWorld'

=============================== ERROR =============================== Could not publish the component due to the following error. Failed to publish new version of component with the given configuration. Failed to calculate the next version of the component during publish. Error while getting the component versions of 'com.example.BatteryAwareHelloWorld' in '<<region>>' from the account '<<aws account>>' during publish. Connection was closed before we received a valid response from endpoint URL: "https://greengrass.us-east-1.amazonaws.com/greengrass/v2/components/arn%3Aaws%3Agreengrass%3A<<region>>%3A<<aws account>>%3Acomponents%3Acom.example.BatteryAwareHelloWorld/versions".

The strange behavior I observed here is that "gdk component publish" command is getting past this step and creating artifacts in S3 bucket once in a while. It is getting succeeded only once in 10 times. I keep getting the above error all the time.

All the suggestions on internet are saying to check VPN connection, firewall settings, network connectivity etc., My doubt is that how is it getting succeeded one or two times with same settings on my side.

Can anyone suggest?

  • Please run the publish command with the --debug switch so we may get a little more insight.

1 Answer
1
Accepted Answer

Hello,

Generally speaking, this error - Connection was closed before we received a valid response from endpoint URL:... can happen due to several reasons such as -

  1. Network Connectivity issues
  2. Firewall block
  3. Packet filtering
  4. The remote API you called takes very long to respond or it is unreachable.
  5. Internet access issue in VPC etc

To summarize - This type of issue usually happens when there is a network issue from the client side.



Now for a deeper dive into the issue, you can run commands such as -

  1. time telnet greengrass.us-east-1.amazonaws.com 443
  • This command, will tell you how much time does your server keeps the connection open while a query response is sent by greengrass.

    • If you don’t have “time” and “telnet” installed on your system. Please install using following commands, if it is an Amazon Linux Image.

      • yum install time -y

      • yum install telnet -y

  1. route print
  • The route print command will fetch us the route table on your instance which will give us an idea if there is anything on the instance blocking the subnet.
  1. You can also perform a nslookup or dig on the endpoint to check if there are any DNS issues.
  2. Finally, if you are still facing issues, as mentioned by Greg, you can run the debug parameter [3] to check the logs.

For example if I had an sts endpoint issue, I could run the --debug parameter like -

aws sts get-caller-identity --endpoint-url https://sts.eu-west-1.amazonaws.com  --debug

References:

[1] https://learn.microsoft.com/en-us/windows-server/administration/windows-commands/nslookup

[2] https://digwebinterface.com/

[3] https://docs.aws.amazon.com/cli/latest/userguide/cli-chap-troubleshooting.html#general-debug

profile pictureAWS
SUPPORT ENGINEER
Yash_C
answered a year ago
  • As you stated it happened to be a network issue at my side. It is working fine when I switched to a different network.

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions