Skip to main content

INVALID_REGION

I'm encountering an error and reviewing the docs to understand what's happening. Please help me resolve this.

Fix Error with AI Tool

Error Cause

Current region parameter and specified environment region are inconsistent, js sdk defaults to ap-shanghai region when region parameter is not specified.

Common error scenarios:

  1. Environment created in ap-guangzhou region, cannot connect to ap-shanghai region
  2. Environment created in ap-beijing region, cannot connect to ap-shanghai region

Solution

Specify correct region

Beijing region

import cloudbase from "@cloudbase/js-sdk";

const app = cloudbase.init({
env: "your-env-id", // Replace with your environment id
region: "ap-beijing", // Defaults to Shanghai region if not provided
});

Guangzhou region

import cloudbase from "@cloudbase/js-sdk";

const app = cloudbase.init({
env: "your-env-id", // Replace with your environment id
region: "ap-guangzhou", // Defaults to Shanghai region if not provided
});