Skip to content

Conversation

@cafreeman
Copy link
Contributor

@cafreeman cafreeman commented May 11, 2021

Closes https://gus.lightning.force.com/lightning/r/ADM_Work__c/a07AH000000LicIYAS/view

Prior to this change, if you tried to create a compute environment associated with an org that did not have functions enabled, the API request would fail with an "Instance Not Found" error message. This is not helpful or informative, and proved to be a massive footgun for basically everyone who tried to use the CLI.

To remedy this, we now verify that the org being passed DOES have functions enabled before trying to create the compute environment. If it does not have functions enabled, we error out and display a helpful error message with instructions telling them what to do.

image

How to test

  • sfdx generate:project -n my_project
  • cd my_project
  • sfdx force:org:create -f config/project-scratch-def.json -a feature-scratch-org
  • sfdx env:create:compute -o feature-scratch-org
  • Verify that it shows an error message with directions about how to fix it.

@cafreeman cafreeman force-pushed the cfreeman/functions-feature-wat branch from ccdc11c to 195fd97 Compare May 12, 2021 19:44
@cafreeman cafreeman force-pushed the cfreeman/functions-feature-wat branch from 195fd97 to 9699adb Compare May 12, 2021 19:49
@cafreeman cafreeman marked this pull request as ready for review May 12, 2021 19:49

const conn = org.getConnection()

// This is a roundabout away of checking if a given org has Functions enabled. If they do NOT have functions enabled,
Copy link
Contributor

@tevanoff tevanoff May 13, 2021

Choose a reason for hiding this comment

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

Minor thing, but this is a lot of noise to check for an exceptional case. Maybe the command source would read better if this whole thing was extracted to a separate function.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is a good point. I'll update.

Copy link
Contributor

@tevanoff tevanoff left a comment

Choose a reason for hiding this comment

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

Left a minor nit, but not blocking 👍

@cafreeman cafreeman merged commit 04e4c5e into main May 13, 2021
@cafreeman cafreeman deleted the cfreeman/functions-feature-wat branch May 13, 2021 16:05
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.

3 participants