diff --git a/packages/cli/commands/project/dev.js b/packages/cli/commands/project/dev.js index 21280777a..239cbba5f 100644 --- a/packages/cli/commands/project/dev.js +++ b/packages/cli/commands/project/dev.js @@ -61,9 +61,11 @@ const { getHubSpotWebsiteOrigin } = require('@hubspot/local-dev-lib/urls'); const { logApiErrorInstance, ApiErrorContext, - isMissingScopeError, - isSpecifiedError, + isSpecifiedError, // Migrate isSpecifiedError to local-dev-lib version only after uploadProject is migrated to local-dev-lib } = require('../../lib/errorHandlers/apiErrors'); +const { + isMissingScopeError, +} = require('@hubspot/local-dev-lib/errors/apiErrors'); const { logErrorInstance } = require('../../lib/errorHandlers/standardErrors'); const i18nKey = 'cli.commands.project.subcommands.dev'; diff --git a/packages/cli/commands/sandbox/create.js b/packages/cli/commands/sandbox/create.js index 6b43d5131..d0a0887e4 100644 --- a/packages/cli/commands/sandbox/create.js +++ b/packages/cli/commands/sandbox/create.js @@ -33,7 +33,9 @@ const { const { promptUser } = require('../../lib/prompts/promptUtils'); const { syncSandbox } = require('../../lib/sandbox-sync'); const { logErrorInstance } = require('../../lib/errorHandlers/standardErrors'); -const { isMissingScopeError } = require('../../lib/errorHandlers/apiErrors'); +const { + isMissingScopeError, +} = require('@hubspot/local-dev-lib/errors/apiErrors'); const { getHubSpotWebsiteOrigin } = require('@hubspot/local-dev-lib/urls'); const i18nKey = 'cli.commands.sandbox.subcommands.create'; diff --git a/packages/cli/commands/sandbox/delete.js b/packages/cli/commands/sandbox/delete.js index f3e24f3ff..67f0ed69b 100644 --- a/packages/cli/commands/sandbox/delete.js +++ b/packages/cli/commands/sandbox/delete.js @@ -15,7 +15,7 @@ const { const { isSpecifiedError, isSpecifiedHubSpotAuthError, -} = require('../../lib/errorHandlers/apiErrors'); +} = require('@hubspot/local-dev-lib/errors/apiErrors'); const { deleteSandbox } = require('@hubspot/local-dev-lib/sandboxes'); const { i18n } = require('../../lib/lang'); const { deleteSandboxPrompt } = require('../../lib/prompts/sandboxesPrompt'); diff --git a/packages/cli/commands/sandbox/sync.js b/packages/cli/commands/sandbox/sync.js index 40a64e1da..18fbdf8d5 100644 --- a/packages/cli/commands/sandbox/sync.js +++ b/packages/cli/commands/sandbox/sync.js @@ -24,7 +24,7 @@ const { } = require('../../lib/sandboxes'); const { syncSandbox } = require('../../lib/sandbox-sync'); const { getValidEnv } = require('@hubspot/local-dev-lib/environment'); -const { isSpecifiedError } = require('../../lib/errorHandlers/apiErrors'); +const { isSpecifiedError } = require('@hubspot/local-dev-lib/errors/apiErrors'); const { logErrorInstance } = require('../../lib/errorHandlers/standardErrors'); const i18nKey = 'cli.commands.sandbox.subcommands.sync'; diff --git a/packages/cli/lang/en.lyaml b/packages/cli/lang/en.lyaml index cd0f6e509..a3ad3d641 100644 --- a/packages/cli/lang/en.lyaml +++ b/packages/cli/lang/en.lyaml @@ -1201,6 +1201,7 @@ en: configFileUpdated: "{{ configFilename }} updated with {{ authMethod }} for account {{ account }}." failure: invalidUser: "Couldn't create {{#bold}}{{ accountName }}{{/bold}} because your account has been removed from {{#bold}}{{ parentAccountName }}{{/bold}} or your permission set doesn't allow you to create the sandbox. To update your permissions, contact a super admin in {{#bold}}{{ parentAccountName }}{{/bold}}." + 403Gating: "Couldn't create {{#bold}}{{ accountName }}{{/bold}} because {{#bold}}{{ parentAccountName }}{{/bold}} does not have access to development sandboxes. To opt in to the CRM Development Beta and use development sandboxes, visit https://app.hubspot.com/l/whats-new/betas?productUpdateId=13860216." limit: developer: one: "{{#bold}}{{ accountName }}{{/bold}} reached the limit of {{ limit }} development sandbox. diff --git a/packages/cli/lib/projects.js b/packages/cli/lib/projects.js index b1d85060d..3c660b651 100644 --- a/packages/cli/lib/projects.js +++ b/packages/cli/lib/projects.js @@ -40,7 +40,7 @@ const SpinniesManager = require('./SpinniesManager'); const { logApiErrorInstance, ApiErrorContext, - isSpecifiedError, + isSpecifiedError, // Migrate isSpecifiedError to local-dev-lib version only after fetchProject is migrated to local-dev-lib isSpecifiedHubSpotAuthError, } = require('./errorHandlers/apiErrors'); const { HUBSPOT_PROJECT_COMPONENTS_GITHUB_PATH } = require('./constants'); diff --git a/packages/cli/lib/sandbox-create.js b/packages/cli/lib/sandbox-create.js index 0a9df04e9..a5cef4794 100644 --- a/packages/cli/lib/sandbox-create.js +++ b/packages/cli/lib/sandbox-create.js @@ -16,7 +16,7 @@ const { const { isMissingScopeError, isSpecifiedError, -} = require('./errorHandlers/apiErrors'); +} = require('@hubspot/local-dev-lib/errors/apiErrors'); const { getHubSpotWebsiteOrigin } = require('@hubspot/local-dev-lib/urls'); const { getEnv, getAccountId } = require('@hubspot/local-dev-lib/config'); const { createSandbox } = require('@hubspot/local-dev-lib/sandboxes'); @@ -101,6 +101,22 @@ const buildSandbox = async ({ }) ); logger.log(''); + } else if ( + isSpecifiedError(err, { + statusCode: 403, + category: 'BANNED', + subCategory: 'SandboxErrors.DEVELOPMENT_SANDBOX_ACCESS_NOT_ALLOWED', + }) + ) { + logger.log(''); + logger.error( + i18n(`${i18nKey}.failure.403Gating`, { + accountName: name, + parentAccountName: accountConfig.name || accountId, + accountId, + }) + ); + logger.log(''); } else if ( isSpecifiedError(err, { statusCode: 400, diff --git a/packages/cli/lib/sandbox-sync.js b/packages/cli/lib/sandbox-sync.js index a7d542fa4..86a335cef 100644 --- a/packages/cli/lib/sandbox-sync.js +++ b/packages/cli/lib/sandbox-sync.js @@ -18,7 +18,7 @@ const { const { isSpecifiedError, isMissingScopeError, -} = require('./errorHandlers/apiErrors'); +} = require('@hubspot/local-dev-lib/errors/apiErrors'); const { getSandboxTypeAsString } = require('./sandboxes'); const { getAccountId } = require('@hubspot/local-dev-lib/config'); const { uiAccountDescription } = require('./ui');