{"id":13754561,"url":"https://github.com/aliyun/serverless-aliyun-function-compute","last_synced_at":"2026-03-11T18:02:25.693Z","repository":{"id":24630195,"uuid":"101968950","full_name":"aliyun/serverless-aliyun-function-compute","owner":"aliyun","description":"Serverless Alibaba Cloud Function Compute Plugin – Add Alibaba Cloud Function Compute support to the Serverless Framework","archived":false,"fork":false,"pushed_at":"2023-01-05T22:16:24.000Z","size":659,"stargazers_count":134,"open_issues_count":46,"forks_count":16,"subscribers_count":17,"default_branch":"master","last_synced_at":"2024-11-16T08:32:23.256Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/aliyun.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-08-31T06:48:13.000Z","updated_at":"2024-06-21T08:47:37.000Z","dependencies_parsed_at":"2023-01-14T01:19:41.618Z","dependency_job_id":null,"html_url":"https://github.com/aliyun/serverless-aliyun-function-compute","commit_stats":null,"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aliyun%2Fserverless-aliyun-function-compute","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aliyun%2Fserverless-aliyun-function-compute/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aliyun%2Fserverless-aliyun-function-compute/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aliyun%2Fserverless-aliyun-function-compute/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/aliyun","download_url":"https://codeload.github.com/aliyun/serverless-aliyun-function-compute/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253346355,"owners_count":21894263,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-08-03T10:00:28.849Z","updated_at":"2025-12-15T17:32:04.781Z","avatar_url":"https://github.com/aliyun.png","language":"JavaScript","readme":"# Aliyun Function Compute Serverless Plugin\n\nThis plugin enables Aliyun Function Compute support within the Serverless Framework.\n\n- [![Build Status](https://travis-ci.org/aliyun/serverless-aliyun-function-compute.svg?branch=master)](https://travis-ci.org/aliyun/serverless-aliyun-function-compute)\n\n## Getting started\n\n### Pre-requisites\n\n* Node.js v8.x for using the plugin.\n* Serverless CLI v1.26.1+. You can get it by running `npm i -g serverless`.\n* An Aliyun account.\n\n### Example\n\nYou can install the following example from GitHub:\n\n```sh\n$ serverless install --url https://github.com/aliyun/serverless-function-compute-examples/tree/master/aliyun-nodejs\n```\n\nThe structure of the project should look something like this:\n\n```\n├── index.js\n├── node_modules\n├── package.json\n└── serverless.yml\n```\n\nInstall `serverless-aliyun-function-compute` plugin to your service.\n\n```yaml\n$ serverless plugin install --name serverless-aliyun-function-compute\n```\n\n`serverless.yml`:\n\n```yaml\nservice: serverless-aliyun-hello-world\n\nprovider:\n  name: aliyun\n  runtime: nodejs8\n  credentials: ~/.aliyun_credentials # path must be absolute\n\nplugins:\n  - serverless-aliyun-function-compute\n\npackage:\n  exclude:\n    - package-lock.json\n    - .gitignore\n    - .git/**\n\nfunctions:\n  hello:\n    handler: index.hello\n    events:\n      - http:\n          path: /foo\n          method: get\n```\n\n`package.json`:\n\n```json\n{\n  \"name\": \"serverless-aliyun-hello-world\",\n  \"version\": \"0.1.0\",\n  \"description\": \"Hello World example for aliyun provider with Serverless Framework.\",\n  \"main\": \"index.js\",\n  \"license\": \"MIT\"\n}\n```\n\n`index.js`:\n\n```js\n'use strict';\n\nexports.hello = (event, context, callback) =\u003e {\n  const response = {\n    statusCode: 200,\n    body: JSON.stringify({ message: 'Hello!' }),\n  };\n\n  callback(null, response);\n};\n```\n\nIn order to deploy this function, we need the credentials with permissions to access Aliyun Function Compute. \nPlease create a `credentials` file and configure the credentials in it. \nHere is an example `credentials` file:\n\n```ini\n[default]\naliyun_access_key_id = xxxxxxxx\naliyun_access_key_secret = xxxxxxxxxxxxxxxxxxxx\naliyun_account_id = 1234567890\n```\n\nYou can find the `aliyun_access_key_secret` and `aliyun_access_key_id` from https://ak-console.aliyun.com/?#/accesskey. You can also chose to create an Access Key or use sub-account Access Key.\nYou can find the `aliyun_account_id` from https://account-intl.console.aliyun.com/?#/secure .\nAfter creating the `credentials` file, please make sure to change the `credentials` field value in `serverless.yml` to the absolute file path.\n\nSee [test/project](./test/project) for a more detailed example (including how to access other Aliyun services, how to set up a HTTP POST endpoint, how to set up OSS triggers, etc.).\n\n### Workflow\n\nMake sure that you have activated Function Compute and any other dependent services such as RAM, Log Service, API Gateway and OSS before attempting to deploy your function.\n\n* Deploy your service to Aliyun:\n\n  ```sh\n  $ serverless deploy\n  ```\n\n  If your service contains HTTP endpoints, you will see the URLs for invoking your functions after a successful deployment.\n\n  Note: you can use `serverless deploy function --function \u003cfunction name\u003e` to deploy a single function instead of the entire service.\n* Invoke a function directly (without going through the API gateway):\n\n  ```sh\n  $ serverless invoke --function hello\n  ```\n* Retrieve the LogHub logs generated by your function:\n\n  ```sh\n  $ serverless logs --function hello\n  ```\n* Get information on your deployed functions\n\n  ```sh\n  $ serverless info\n  ```\n* When you no longer needs your service, you can remove the service, functions, along with deployed endpoints and triggers using:\n\n  ```sh\n  $ serverless remove\n  ```\n\n  Note: by default RAM roles and policies created during the deployment are not removed. You can use `serverless remove --remove-roles` if you do want to remove them.\n\n#### Change Region\n\n* Changing the region in provider of serverless.yml:\n  ```yaml\n  provider:\n    name: aliyun\n    region: cn-hongkong\n  ```\n\n* Changing the region in CLI parameters:\n  ```sh\n  $ serverless deploy --region cn-hongkong\n  ```\n\n  Note: CLI parameter `--region` has higher priority than provider, But you have to add this parameter to all the invocations, not only `deploy`.\n\n## Develop\n\n```sh\n# clone this repo\ngit clone git@github.com:aliyun/serverless-aliyun-function-compute.git\n\n# link this module to global node_modules\ncd serverless-aliyun-function-compute\nnpm install\nnpm link\n\n# try it out by packaging the test project\ncd test/project\nnpm install\nnpm link serverless-aliyun-function-compute\nserverless package\n```\n\n## License\n\nMIT\n","funding_links":[],"categories":["1. 后端开发"],"sub_categories":["1.2 框架"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faliyun%2Fserverless-aliyun-function-compute","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Faliyun%2Fserverless-aliyun-function-compute","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faliyun%2Fserverless-aliyun-function-compute/lists"}