Skip to content

Conversation

@tdstein
Copy link
Collaborator

@tdstein tdstein commented Jan 23, 2023

Description

Connected to #247

On a failed deployment where the application already exists, additional context is added to the error message to provide the user with a recommended action.

Testing Notes / Validation Steps

A new unit test is added to validate that the original exception is caught, the new message is appended, and a new exception is thrown.

Manual Validation

  1. Deploy a new application to connect.
  2. Delete the application from connect.
  3. Deploy the same application to connect.

After step 3, the following type of error message should be presented:

Error: Posit Connect reported an error (calling /__api__/applications/60e72620-6c3f-4666-8032-f049758cd19c): The requested object does not exist. Try setting the --new flag to overwrite the previous deployment.

@tdstein tdstein force-pushed the 247-update-error-message branch 6 times, most recently from 411f3d5 to 2662151 Compare January 24, 2023 20:14
On a failed deployment where the application already exists, additional
context is added to the error message to provide the user with a
recommended action.
@tdstein tdstein force-pushed the 247-update-error-message branch from 2662151 to a344d00 Compare January 24, 2023 20:15
@tdstein tdstein marked this pull request as ready for review January 24, 2023 20:18
@kgartland-rstudio
Copy link
Contributor

Verified.

Previous Behavior:

> rsconnect deploy api ./ -s http://localhost:3939 -k ${DEFAULT_ADMIN_API_KEY}
Validating server... 	[OK]
Validating app mode... 	[OK]
Making bundle ... 	[OK]
Deploying bundle ... 	[ERROR]: Posit Connect reported an error (calling /__api__/applications/4ca1c497-3cdf-40c5-ae0f-f427281d7007): The requested object does not exist.
Error: Posit Connect reported an error (calling /__api__/applications/4ca1c497-3cdf-40c5-ae0f-f427281d7007): The requested object does not exist.

New Error:

> rsconnect deploy api ./ -s http://localhost:3939 -k ${DEFAULT_ADMIN_API_KEY}
Validating server... 	[OK]
Validating app mode... 	[OK]
Making bundle ... 	[OK]
Deploying bundle ... 	[ERROR]: Posit Connect reported an error (calling /__api__/applications/4ca1c497-3cdf-40c5-ae0f-f427281d7007): The requested object does not exist. Try setting the --new flag to overwrite the previous deployment.
Error: Posit Connect reported an error (calling /__api__/applications/4ca1c497-3cdf-40c5-ae0f-f427281d7007): The requested object does not exist. Try setting the --new flag to overwrite the previous deployment.

However when you specify an --app-id we send the old error. Can we update this path too while we're at it?

> rsconnect deploy api ./ -s http://localhost:3939 -k ${DEFAULT_ADMIN_API_KEY} --app-id 12
Validating server... 	[OK]
Validating app mode... 	[ERROR]: Posit Connect reported an error (calling /__api__/applications/12): The requested object does not exist.
Error: Posit Connect reported an error (calling /__api__/applications/12): The requested object does not exist.
``

@tdstein tdstein linked an issue Feb 6, 2023 that may be closed by this pull request
@tdstein
Copy link
Collaborator Author

tdstein commented Feb 6, 2023

Resolves #247

@tdstein
Copy link
Collaborator Author

tdstein commented Feb 6, 2023

However when you specify an --app-id we send the old error. Can we update this path too while we're at it?

Thanks, @kgartland-rstudio - I will add this change.

@tdstein tdstein force-pushed the 247-update-error-message branch from a7512aa to 0249931 Compare February 6, 2023 18:33
rsconnect/api.py Outdated
self.state["app_id"] = app_id
self.state["app_mode"] = app_mode
return self
try:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Marking this entire block for one error feels a bit odd, as other unrelated errors might occur. Another way to do this could be to use get_app_info to check whether the app still exists. The place for adding the specific exception would be L847-L857.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, @bcwu - I've updated the try/except block to be more specific.

@tdstein tdstein force-pushed the 247-update-error-message branch from 0249931 to b97d0b8 Compare February 6, 2023 19:08
@tdstein
Copy link
Collaborator Author

tdstein commented Feb 8, 2023

@kgartland-rstudio - would you like to revalidate this?

@kgartland-rstudio
Copy link
Contributor

@kgartland-rstudio - would you like to revalidate this?

Sure, sorry I didn't see that was ready to go.

@tdstein
Copy link
Collaborator Author

tdstein commented Feb 8, 2023

@kgartland-rstudio - would you like to revalidate this?

Sure, sorry I didn't see that was ready to go.

No worries! This is pretty low priority.

@kgartland-rstudio
Copy link
Contributor

This looks good in both cases now:

> rsconnect deploy notebook content/notebook/stock-report-jupyter.ipynb --app-id 234 -s http://localhost:3939 -k ${DEFAULT_ADMIN_API_KEY}
Validating server... 	[OK]
Validating app mode... 	[ERROR]: Posit Connect reported an error (calling /__api__/applications/234): The requested object does not exist. Try setting the --new flag to overwrite the previous deployment.
Error: Posit Connect reported an error (calling /__api__/applications/234): The requested object does not exist. Try setting the --new flag to overwrite the previous deployment.

@tdstein tdstein merged commit 81ff597 into master Feb 8, 2023
@tdstein tdstein deleted the 247-update-error-message branch February 8, 2023 18:11
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

Successfully merging this pull request may close these issues.

Better error if app cannot be found to update

5 participants