edit-icon download-icon

Context

Last Updated: Mar 29, 2018

A context object is provided by the Function Compute for users to obtain useful runtime information. For example, you can obtain the ID of the current request and record it in the running log. Thus, you use it to track the details of request execution.

Context object (Node.js)

  1. {
  2. // Request ID of the current request
  3. requestId: "...",
  4. // Credentials contains your identity verification information that is required for you to access other services.
  5. // For example, you need them to access data in the specified OSS directory.
  6. // You must explicitly assign roles to the service on creation to use them.
  7. // For more information, see the permission management documentation.
  8. credentials: {
  9. accessKeyId: "...",
  10. accessKeySecret: "...",
  11. securityToken: "..."
  12. },
  13. // Related function information
  14. function: {
  15. name: "...",
  16. handler: "...",
  17. memory: 128, // Integer, in MB.
  18. timeout: 60 // Integer, in seconds.
  19. }
  20. }

Note: Currently, all attributes of the context objects are read-only.

Thank you! We've received your feedback.