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

improve error messaging for "Your socket connection to the server... will be closed" #11835

Open
2 tasks done
Alambre020 opened this issue Jan 24, 2023 · 21 comments
Open
2 tasks done
Labels
bug Something isn't working good first issue Good for newcomers ops-errors Operational theme: centralized error messaging p3 platform-push Issues related to `amplify push`

Comments

@Alambre020
Copy link

Alambre020 commented Jan 24, 2023

How did you install the Amplify CLI?

npm

If applicable, what version of Node.js are you using?

v19.0.1

Amplify CLI Version

10.6.2

What operating system are you using?

Ubuntu

Did you make any manual changes to the cloud resources managed by Amplify? Please describe the changes made.

There is an existing override.ts but is the original from functional deployments.

Describe the bug

Initializing an existing project under my own account.
Removed the amplify team-provider-info.json file.
Getting error on amplify push:

**
:~/Documents/DeckAnalyzer$ amplify push
✖ There was an error pulling the backend environment devtwo.
🛑 Packaging overrides failed.
Command failed with exit code 1: yarn install

Resolution: There may be errors in your overrides file. If so, fix the errors and try again.
Learn more at: https://docs.amplify.aws/cli/project/troubleshooting/

Session Identifier: 23f96950-8041-44f9-8a30-2a76743c0494

**

Expected behavior

Expected project to initialize and deploy.

Reproduction steps

amplify init
delete team-provider-info.json
amplify push

Project Identifier

Project Identifier: caa1b95f02a190bcb0b4ee7bcb9e7b6f

Log output

# Put your logs below this line


Additional information

No response

Before submitting, please confirm:

  • I have done my best to include a minimal, self-contained set of instructions for consistently reproducing the issue.
  • I have removed any sensitive information from my code snippets and submission.
@Alambre020 Alambre020 added the pending-triage Issue is pending triage label Jan 24, 2023
@josefaidt
Copy link
Contributor

Hey @Alambre020 👋 thanks for raising this! The reproduction steps do not seem to follow the typical paths for pushing Amplify projects. What is the use case for deleting the team-provider-info.json file?

@josefaidt josefaidt added the pending-response Issue is pending response from the issue author label Jan 24, 2023
@svidgen
Copy link
Member

svidgen commented Jan 24, 2023

Hey @josefaidt, I was actually working with @Alambre020 to try to get him spun up on a personal project, and this is where we got stuck. (We hit a few other CLI snags as well, but I'm chalking that up to forgetting what order to run initial CLI setup commands in for now.)

Removing the team-provider-info.json is recommended in our docs when trying to share projects with completely separate backend deployments (different accounts): https://docs.amplify.aws/cli/teams/shared/#sharing-projects-within-the-team

If you want to share a project publicly and open source your serverless infrastructure, you should remove or put the amplify/team-provider-info.json file in the .gitignore file.

Feel free to pull me to help repro this one, as I own the original app + source.

@josefaidt
Copy link
Contributor

josefaidt commented Jan 24, 2023

Hey @svidgen and @Alambre020 perhaps we can update the docs to suggest only adding it to gitignore rather than removing it entirely, or clarify why it would be suggested to remove it. In short, you will still need this file to work within the project, including push attempts.

When sharing projects, the team-provider-info.json can be safely removed/ignored before the person you are sharing it with runs amplify init to create the project in their account.

If you do not remove the team-provider-info.json the person you are sharing the project with cannot initialize the project in their account using the same environment name as the existing envs in this file. For example, if I created the dev environment in my AWS account and shared the project with you, you would not also be able to create a dev environment, and you would instead be presented with an "AccessDenied" error since the CLI will recognize the environment name and attempt to reference resources in my account.

Additionally, if you do not remove this file I would be able to safely initialize the project using a different environment name such as devtwo or myowndev

@svidgen
Copy link
Member

svidgen commented Jan 24, 2023

When sharing projects, the team-provider-info.json can be safely removed/ignored before the person you are sharing it with runs amplify init to create the project in their account.

This was the intended use-case. Initially we tried to use dev as well — I don't actually recall what error we saw there. After changing it to devtwo, it appeared to start successfully deploying until it hit the overrides error.

@josefaidt
Copy link
Contributor

Thanks for clarifying @svidgen ! What sort of overrides issues were you running into?

@svidgen
Copy link
Member

svidgen commented Jan 24, 2023

@Alambre020 I chatted with @josefaidt and he was able to pull the repo and push it without issue. Hopefully we just mindlessly flipped some commands. Let's try this fresh and make sure to run things strictly in this order:

  1. git clone
  2. remove team-provider-info.json
  3. amplify init
  4. amplify push

@josefaidt Thanks for your time. @Alambre020 or I will post back when we've had a chance to retry this.

@josefaidt josefaidt self-assigned this Jan 30, 2023
@svidgen
Copy link
Member

svidgen commented Feb 4, 2023

@Alambre020 Do you have a non-Ubuntu machine you can try this on?

@Alambre020
Copy link
Author

@svidgen, it hasn't been turned on in long time but i can try tomorrow

@github-actions github-actions bot removed the pending-response Issue is pending response from the issue author label Feb 4, 2023
@Alambre020
Copy link
Author

@svidgen @josefaidt , I was able to test on a windows machine. I got through the init successfully. The push failed.

" There was an error pulling the backend environment dev. "

It cannot find .aws\conifg

@josefaidt
Copy link
Contributor

Hey @Alambre020 does the ~/.aws/config file exist? If not, can you create one with a profile reference and region? For example:

# ~/.aws/config
[default]
region=us-east-1

@josefaidt josefaidt added the pending-response Issue is pending response from the issue author label Feb 10, 2023
@Alambre020
Copy link
Author

It seems like it's looking in the wrong folder??

image

@github-actions github-actions bot removed the pending-response Issue is pending response from the issue author label Feb 12, 2023
@josefaidt
Copy link
Contributor

Hey @Alambre020 I do not recognize that directory name, but after a bit of googling it seems like this is related to Cygwin? Are you using Cygwin by chance? Can you check the value of your HOME env var?

@josefaidt josefaidt added the pending-response Issue is pending response from the issue author label Feb 13, 2023
@josefaidt
Copy link
Contributor

Hey @Alambre020 are you still experiencing this issue?

@Alambre020
Copy link
Author

@josefaidt , yes sorry... Been away from this in a while and will have to check this week. Last i remember i tried on an old windows machine and still had issues.

@github-actions github-actions bot removed the pending-response Issue is pending response from the issue author label Mar 21, 2023
@Alambre020
Copy link
Author

@josefaidt, my home variable is C:\Users\Nick\AppData\Roaming\SPB_Data which does seem to have the file that the error says is missing:

image

I do not see any cygwin installed.

@josefaidt
Copy link
Contributor

Hey @Alambre020 no worries about cygwin, I was doing some digging on this path to understand what app SPB_Data relates to, and it appeared related to Cygwin.

Additionally, there is a typo in that path (.asw -> .aws)

@josefaidt josefaidt added the pending-response Issue is pending response from the issue author label Mar 27, 2023
@josefaidt
Copy link
Contributor

Hey @Alambre020 are you still experiencing this?

@Alambre020
Copy link
Author

@josefaidt , yes. Sorry for the delay and thank you for continuing to check in. I will have time to look at this again this weekend. I will have to double check the patching... If it is the cgwin... What should I try first? I'm not really familiar with it or not sure what i would've installed it for.

@github-actions github-actions bot removed the pending-response Issue is pending response from the issue author label Apr 13, 2023
@Alambre020
Copy link
Author

@josefaidt @svidgen , after renaming the folder I did get farther in the process. It's possible I named it incorrectly but should this be a folder that the amplify process should create?

Now the process timed out:

image

@Alambre020
Copy link
Author

@josefaidt when i run the push again it says there are no changes? so maybe the first pushed worked after renaming the .aws folder?

image

@josefaidt
Copy link
Contributor

josefaidt commented Apr 17, 2023

Hey @Alambre020 thanks for checking on that! That error seems to be coming in after the CloudFormation push was successful, where there is some project state and files that are being uploaded at the end. This error and subsequent push attempt leads me to believe the operation was likely successful and the connection was not closed properly.

I will mark this as a bug to improve the error handling and messaging here

https://github.com/aws-amplify/amplify-cli/blob/dev/packages/amplify-provider-awscloudformation/src/aws-utils/aws-s3.ts#L134
image

Despite the oddity it does appear to be successful.

@josefaidt josefaidt added bug Something isn't working platform-push Issues related to `amplify push` ops-errors Operational theme: centralized error messaging and removed pending-triage Issue is pending triage labels Apr 17, 2023
@josefaidt josefaidt changed the title Unable to Push, Packing override fails improve error messaging for "Your socket connection to the server... will be closed" Apr 17, 2023
@josefaidt josefaidt assigned goldbez and unassigned josefaidt Apr 17, 2023
@josefaidt josefaidt added bug Something isn't working and removed bug Something isn't working labels Apr 18, 2023
@josefaidt josefaidt added good first issue Good for newcomers p3 labels May 9, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working good first issue Good for newcomers ops-errors Operational theme: centralized error messaging p3 platform-push Issues related to `amplify push`
Projects
None yet
Development

No branches or pull requests

4 participants