Tencent-SCF Workflow Tips
Quick recommendations and tips for various processes.
- Write your functions
serverless deployonly when you've made changes to
serverless.ymland in CI/CD systems.
serverless deploy function -f myFunctionto rapidly deploy changes when you are working on a specific Serverless Cloud Function.
serverless invoke -f myFunctionto test your functions on Tencent Cloud.
- Open up a separate tab in your console and stream logs in there via
serverless logs -f myFunction -t.
- Write tests to run locally.
- At the very least, use a
- Use different Tencent Cloud accounts for stages.
- In larger teams, each member should use a separate Tencent Cloud account and their own stage for development.
- Break your application/project into multiple Serverless Services.
- Model your Serverless Services around Data Models or Workflows.
- Keep the Functions and Resources in your Serverless Services to a minimum.
A handy list of commands to use when developing with the Serverless Framework.
Create A Service:
Creates a new Service
serverless create -p [SERVICE NAME] -t tencent-nodejs
Install A Service
This is a convenience method to install a pre-made Serverless Service locally by downloading the Github repo and unzipping it.
serverless install -u [GITHUB URL OF SERVICE]
Use this when you have made changes to your Functions, Events or Resources in
serverless.yml or you simply want to deploy all changes within your Service at the same time.
serverless deploy -s [STAGE NAME] -r [REGION NAME] -v
Use this to quickly overwrite your SCF code on Tencent Cloud, allowing you to develop faster.
serverless deploy function -f [FUNCTION NAME] -s [STAGE NAME] -r [REGION NAME]
Invokes a Serverless Cloud Function and returns logs.
serverless invoke -f [FUNCTION NAME] -s [STAGE NAME] -r [REGION NAME] -l
Open up a separate tab in your console and stream all logs for a specific Function using this command.
serverless logs -f [FUNCTION NAME] -s [STAGE NAME] -r [REGION NAME]
See information about your deployed/undeployed functions by running the info command in your service directory.