All Products
Search
Document Center

Function Compute:What do I do if the "The Access Key ID does not exist" message is returned when I use the information in the context parameter of a function such as the AccessKey ID to access other cloud resources?

Last Updated:Aug 20, 2025

The context parameter of a function includes a temporary key that consists of the AccessKey ID, AccessKey secret, and security token. If the security token is not provided, the "The Access Key ID does not exist" message is returned.

The following example demonstrates how to access Object Storage Service (OSS) code in a Python function.

import json
import oss2
def my_handler(event, context):
    evt = json.loads(event)
    creds = context.credentials
    # Do not omit the security token for authentication.
    # Do not miss the "security_token" for the authentication!
    auth = oss2.StsAuth(creds.access_key_id, creds.access_key_secret, creds.security_token)
    bucket = oss2.Bucket(auth, evt['endpoint'], evt['bucket'])
    bucket.put_object(evt['objectName'], evt['message'])
    return 'success'