{"record":{"id":"be1b7d58ad1592b4","repo":"appsmithorg/appsmith","slug":"pe-dse-5003-be1b7d","errorCode":"PE-DSE-5003","errorMessage":"Missing region in datasource.","messagePattern":"Missing region in datasource\\.","errorType":"exception","errorClass":"AppsmithPluginException","httpStatus":500,"severity":"error","filePath":"app/server/appsmith-plugins/dynamoPlugin/src/main/java/com/external/plugins/DynamoPlugin.java","lineNumber":642,"sourceCode":"    private static boolean isUpperCase(String s) {\n        for (char c : s.toCharArray()) {\n            if (!Character.isUpperCase(c)) {\n                return false;\n            }\n        }\n        return true;\n    }\n\n    private static DynamoDbClient getDynamoDBClientObject(\n            DatasourceConfiguration dsConfig, DynamoDbClientBuilder builder) {\n        if (!CollectionUtils.isEmpty(dsConfig.getEndpoints())) {\n            final Endpoint endpoint = dsConfig.getEndpoints().get(0);\n            builder.endpointOverride(URI.create(\"http://\" + endpoint.getHost() + \":\" + endpoint.getPort()));\n        }\n\n        final DBAuth authentication = (DBAuth) dsConfig.getAuthentication();\n        if (authentication == null || !StringUtils.hasLength(authentication.getDatabaseName())) {\n            throw new AppsmithPluginException(\n                    AppsmithPluginError.PLUGIN_DATASOURCE_ARGUMENT_ERROR, DynamoErrorMessages.MISSING_REGION_ERROR_MSG);\n        }\n\n        builder.region(Region.of(authentication.getDatabaseName()));\n\n        builder.credentialsProvider(StaticCredentialsProvider.create(\n                AwsBasicCredentials.create(authentication.getUsername(), authentication.getPassword())));\n\n        return builder.build();\n    }\n}\n","sourceCodeStart":624,"sourceCodeEnd":654,"githubUrl":"https://github.com/appsmithorg/appsmith/blob/8cd9021c24cdbea1c3c12c966073708e83db60c2/app/server/appsmith-plugins/dynamoPlugin/src/main/java/com/external/plugins/DynamoPlugin.java#L624-L654","documentation":"In getDynamoDBClientObject(), the datasource authentication (cast to DBAuth) must be non-null and its getDatabaseName() — which stores the AWS region — must be non-empty. If either check fails, throws PLUGIN_DATASOURCE_ARGUMENT_ERROR (PE-DSE-5003). The DynamoDbClient builder requires a Region before it can be constructed.","triggerScenarios":"A DynamoDB datasource is configured without a region, or its authentication object is null. This fires when the plugin attempts to build the client, which happens during datasource testing and query execution.","commonSituations":"The Region field was left empty in the datasource configuration form; the datasource was created programmatically without setting the authentication.databaseName; a migration that dropped the region value.","solutions":["Set the AWS region (e.g. us-east-1, eu-west-1) in the datasource configuration.","If creating the datasource programmatically, set authentication.setDatabaseName(\"us-east-1\") before calling the plugin.","Re-test the datasource after saving the region to confirm the client builds."],"exampleFix":"// before — region missing\nDBAuth auth = new DBAuth();\nauth.setDatabaseName(\"\"); // region is blank\n\n// after\nDBAuth auth = new DBAuth();\nauth.setDatabaseName(\"us-east-1\");","handlingStrategy":"validation","validationCode":"DBAuth auth = (DBAuth) dsConfig.getAuthentication();\nif (auth == null || !StringUtils.hasLength(auth.getDatabaseName())) {\n    throw new IllegalArgumentException(\n        \"AWS region is required in the datasource (stored in authentication.databaseName).\");\n}\n// also validate it is a real region\nRegion.of(auth.getDatabaseName()); // throws IllegalArgumentException if invalid","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always set the AWS region when creating a DynamoDB datasource.","Validate the region string with Region.of(...) before building the client.","Re-test the datasource after saving the region."],"tags":["dynamodb","datasource","region","aws-config","pe-dse-5003"],"backgroundTag":null,"analyzedSha":"8cd9021c24cdbea1c3c12c966073708e83db60c2","analyzedAt":"2026-08-12T22:14:19.293Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}