You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@flink.apache.org by "wujinhu (Jira)" <ji...@apache.org> on 2022/04/09 01:23:00 UTC

[jira] [Commented] (FLINK-27134) OSS sink can't get access key id

    [ https://issues.apache.org/jira/browse/FLINK-27134?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17519855#comment-17519855 ] 

wujinhu commented on FLINK-27134:
---------------------------------

[~AlexZax] You used EnvironmentVariableCredentialsProvider in flink-conf.yaml, EnvironmentVariableCredentialsProvider reads access key from environment
{code:java}
// code placeholder
public class EnvironmentVariableCredentialsProvider implements CredentialsProvider {

    @Override
    public void setCredentials(Credentials creds) {
        
    }

    @Override
    public Credentials getCredentials() {
        String accessKeyId = StringUtils.trim(System.getenv(AuthUtils.ACCESS_KEY_ENV_VAR));
        String secretAccessKey = StringUtils.trim(System.getenv(AuthUtils.SECRET_KEY_ENV_VAR));
        String sessionToken = StringUtils.trim(System.getenv(AuthUtils.SESSION_TOKEN_ENV_VAR));

        if (accessKeyId == null || accessKeyId.equals("")) {
            throw new InvalidCredentialsException("Access key id should not be null or empty.");
        }
        if (secretAccessKey == null || secretAccessKey.equals("")) {
            throw new InvalidCredentialsException("Secret access key should not be null or empty.");
        }
        
        return new DefaultCredentials(accessKeyId, secretAccessKey, sessionToken);
    }

} {code}

> OSS sink can't get  access key id
> ---------------------------------
>
>                 Key: FLINK-27134
>                 URL: https://issues.apache.org/jira/browse/FLINK-27134
>             Project: Flink
>          Issue Type: Bug
>          Components: FileSystems
>    Affects Versions: 1.12.3
>         Environment: flink version: 1.12.3
> patch: flink-11388
> fs.oss.sdk.version:3.4.1
> add flink-conf.yaml:
> fs.oss.credentials.provider: com.aliyun.oss.common.auth.EnvironmentVariableCredentialsProvider
> fs.oss.endpoint: cn-shanghai-internal.aliyuncs.com
> fs.oss.accessKeyId: ******
> fs.oss.accessKeySecret: ******
>            Reporter: Alex Z
>            Priority: Major
>         Attachments: error_info.png, keyid.png
>
>
> When I cherry-pick the flink-11388 patch to our flink code(version:1.12.3),the OSS sink can't Work.The error message is Access key id should not be null or empty,but I has been added the OSS configuration in flink-conf.yaml .And the configuration propertity also print the correct *fs.oss.accessKeyId*



--
This message was sent by Atlassian Jira
(v8.20.1#820001)