{"record":{"id":"463011a8d33f8f99","repo":"apache/dolphinscheduler","slug":"failed-to-build-aliyun-serverless-spark-client","errorCode":null,"errorMessage":"Failed to build Aliyun-Serverless-Spark client!","messagePattern":"Failed to build Aliyun-Serverless-Spark client!","errorType":"exception","errorClass":"AliyunServerlessSparkTaskException","httpStatus":null,"severity":"error","filePath":"dolphinscheduler-task-plugin/dolphinscheduler-task-aliyunserverlessspark/src/main/java/org/apache/dolphinscheduler/plugin/task/aliyunserverlessspark/AliyunServerlessSparkTask.java","lineNumber":121,"sourceCode":"        ResourceParametersHelper resourceParametersHelper = taskExecutionContext.getResourceParametersHelper();\n        DataSourceParameters dataSourceParameters = (DataSourceParameters) resourceParametersHelper\n                .getResourceParameters(ResourceType.DATASOURCE, aliyunServerlessSparkParameters.getDatasource());\n        aliyunServerlessSparkConnectionParam = (AliyunServerlessSparkConnectionParam) DataSourceUtils\n                .buildConnectionParams(\n                        DbType.valueOf(aliyunServerlessSparkParameters.getType()),\n                        dataSourceParameters.getConnectionParams());\n\n        accessKeyId = aliyunServerlessSparkConnectionParam.getAccessKeyId();\n        accessKeySecret = aliyunServerlessSparkConnectionParam.getAccessKeySecret();\n        regionId = aliyunServerlessSparkConnectionParam.getRegionId();\n        endpoint = aliyunServerlessSparkConnectionParam.getEndpoint();\n\n        try {\n            aliyunServerlessSparkClient =\n                    buildAliyunServerlessSparkClient(accessKeyId, accessKeySecret, regionId, endpoint);\n        } catch (Exception e) {\n            log.error(\"Failed to build Aliyun-Serverless-Spark client!\", e);\n            throw new AliyunServerlessSparkTaskException(\"Failed to build Aliyun-Serverless-Spark client!\");\n        }\n\n        currentState = RunState.Submitted;\n    }\n\n    @Override\n    public void handle(TaskCallBack taskCallBack) throws TaskException {\n        GetTemplateResponse getTemplateResponse = RetryUtils.retryFunction(() -> {\n            try {\n                return aliyunServerlessSparkClient.getTemplate(\n                        aliyunServerlessSparkParameters.getWorkspaceId(),\n                        buildGetTemplateRequest());\n            } catch (Exception e) {\n                throw new TaskException(\"Failed to get template info\", e);\n            }\n        }, retryPolicy);\n\n        if (getTemplateResponse != null) {","sourceCodeStart":103,"sourceCodeEnd":139,"githubUrl":"https://github.com/apache/dolphinscheduler/blob/02eac45a1b6676e639fcbfb4be2243de5771b05d/dolphinscheduler-task-plugin/dolphinscheduler-task-aliyunserverlessspark/src/main/java/org/apache/dolphinscheduler/plugin/task/aliyunserverlessspark/AliyunServerlessSparkTask.java#L103-L139","documentation":"During init, AliyunServerlessSparkTask builds the Aliyun (EMR Serverless Spark) SDK client from accessKeyId/accessSecret/regionId/endpoint. Any exception while constructing that client is wrapped and rethrown as AliyunServerlessSparkTaskException \"Failed to build Aliyun-Serverless-Spark client!\".","triggerScenarios":"buildAliyunServerlessSparkClient throwing due to invalid/missing accessKeyId or accessKeySecret, bad regionId or endpoint format, missing SDK classes, or network failure resolving the endpoint — inside init().","commonSituations":"Wrong or absent Aliyun credentials (tenant-level or stored token); endpoint/region mismatch (e.g. endpoint for the wrong region); corporate proxy/firewall blocking the endpoint; Aliyun Java SDK dependency conflicts.","solutions":["Verify the stored accessKeyId/accessSecret (user token) and that they are valid for the account","Check regionId and endpoint values match each other and the target workspace region","Ensure network/DNS/proxy reachability of the endpoint from the worker host","Confirm the Aliyun SDK dependency is present and versions are compatible"],"exampleFix":"// before\nendpoint=\"https://emr-serverless.spark.cn-beijing.invalid.aliyuncs.com\"\n// after\nendpoint=\"https://emr-serverless-spark.cn-hangzhou.aliyuncs.com\"  // correct region endpoint","handlingStrategy":"try-catch","validationCode":"if (accessKeyId == null || accessKeyId.isEmpty() || accessKeySecret == null || accessKeySecret.isEmpty()) {\n    throw new IllegalArgumentException(\"Aliyun credentials must be configured before init\");\n}\n// also sanity-check endpoint/region formats","typeGuard":null,"tryCatchPattern":"try {\n    task.init();\n} catch (AliyunServerlessSparkTaskException e) {\n    if (e.getMessage().contains(\"Failed to build\")) {\n        log.error(\"Client construction failed; check credentials/endpoint/SDK deps\", e);\n    }\n}","preventionTips":["Store valid Aliyun credentials in the token/user management, not ad-hoc","Verify endpoint matches the workspace region","Pin compatible Aliyun SDK versions on worker classpath","Test endpoint connectivity from worker hosts (curl/telnet) before rollout"],"tags":["aliyun","task-plugin","client-init","credentials"],"backgroundTag":"module-init-failed","analyzedSha":"02eac45a1b6676e639fcbfb4be2243de5771b05d","analyzedAt":"2026-09-06T17:43:00.555Z","contentChangedAt":"2026-09-06T17:43:00.555Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}