Search code examples
alibaba-cloud

aliyun cli SDK Error on product Container Registry (CR)


Hello I'm using aliyun CLI Version 3.0.15

and configure the right credentials to it

 ./aliyun --version
Alibaba Cloud Command Line Interface Version 3.0.15

When i query GetRegion or any other defined API related to Container Registry (CR) I got the SDK Error

Usage one

$ ./aliyun cr  GetRegion
ERROR: SDK.ServerError
ErrorCode: ServiceUnavailable
Recommend: https://error-center.aliyun.com/status/search?Keyword=ServiceUnavailable&source=PopGw
RequestId: 2FBF6A60-D3F1-46A2-8985-919B44032B45
Message: The request has failed due to a temporary failure of the server.

Usage Two

$ ./aliyun cr GET /regions
ERROR: SDK.ServerError
ErrorCode: ServiceUnavailable
Recommend: https://error-center.aliyun.com/status/search?Keyword=ServiceUnavailable&source=PopGw
RequestId: 64E93F6F-94FE-45B8-9550-9E2B77EFD623
Message: The request has failed due to a temporary failure of the server.

I checked the API it's correct

./aliyun cr --help 

What wrong i'm doing here


Solution

  • In macOS Mojave 10.14.4, I was able to reproduce your issue (also using aliyun cli version 3.0.15). The issue seems to be (as @wanghq mentioned) that the team has made an update to the aliyuncli tool that hasn't made it into the binary yet. I was able to fix the issue by compiling from source:

    export GOPATH=/Users/xiaomei/Downloads
    mkdir -p $GOPATH/src/github.com/aliyuncd $GOPATH/src/github.com/aliyun
    cd $GOPATH
    git clone http://github.com/aliyun/aliyun-cli.git
    git clone http://github.com/aliyun/aliyun-openapi-meta.git
    cd aliyun-cli/
    make install
    sudo cp out/aliyun /usr/local/bin/.
    

    Of course your GOPATH should be replaced with something else (/Users/xiaomei being my own home directory!).

    I added the last line to make sure aliyun gets moved to /usr/local/bin, because that's where I prefer to keep it. You could just run it from the build directory if you prefer.

    The command aliyun cr GetRegionList works fine after I build from source.