up icon indicating copy to clipboard operation
up copied to clipboard

Better error message when up.json is missing

Open naartjie opened this issue 7 years ago • 5 comments

Prerequisites

  • [x] I am running the latest version. (up upgrade)
  • [x] I searched to see if the issue already exists.
  • [x] I inspected the verbose debug output with the -v, --verbose flag.
  • [ ] Are you an Up Pro subscriber?

Description

I came across an error message which could possibly be improved, while I was trying to trying to set up CI on my project. My project is a mono repo, and the up project is in a subdirectory. I was being daft, and running up in the root directory, instead of the subdirectory with up.json. It took me quite a while to find out what the problem was, because of the error message.

Steps to Reproduce

docker run -ti node:6.10 /bin/bash
# inside the docker container
curl -f https://up.apex.sh/install | sh
mkdir ./empty-dir
cd ./empty-dir
up
# error message:
Error: Cannot find credentials, visit https://up.docs.apex.sh/#aws_credentials for help.
# expected something like
No up.json found ...

Note, if I run up [0.4.10] on my OS X 10.12.6, I get the expected:

No up.json found, create a new project? (Y/n)

naartjie avatar Jan 26 '18 18:01 naartjie

ahhh the CI must have fooled the isatty check https://github.com/apex/up/blob/master/internal/cli/deploy/deploy.go#L35

wonder if that's really a good thing on their part, if there's no interactive stdin

tj avatar Jan 27 '18 17:01 tj

ahhh the CI must have fooled the isatty check

Although it looks like it happens in interactive shells too. My repro example was in an interactive docker shell, and I just tried on a ubuntu VM and I got the same error message about credentials.

naartjie avatar Jan 28 '18 08:01 naartjie

Right now it has a select input for the AWS profile, so it bails on helping create up.json if there's no creds. Ideally it'd help walk through adding a profile but I haven't added that part yet

tj avatar Jan 28 '18 18:01 tj

This is minor, so I'm going to close this, as I'm sure there are more important things to work on.

naartjie avatar Jan 30 '18 13:01 naartjie

Hi, I just hit this again today, in a Semaphore CI build, the up.json file was missing on this specific branch. I was confused and it took me a while to figure out what the problem was, so I'm reopening. Hope that's okay.

naartjie avatar Aug 10 '18 10:08 naartjie