Deploy Backend
Step-by-step guide for deploying the backend Lambda functions and infrastructure.
Prerequisites
- Node.js 20.x installed
- AWS CLI v2 configured with the
dissertation-editorprofile - Serverless Framework 3 installed (
npm install -g serverless@3)
Full Deployment
A full deployment updates all Lambda functions, API Gateway configuration, DynamoDB tables, S3 buckets, and IAM roles via CloudFormation.
cd platform/backend
npm install
AWS_SDK_LOAD_CONFIG=1 npx serverless deploy --aws-profile dissertation-editor
Expected output:
Deploying dissertation-editor-backend to stage dev (us-east-1)
ā Service deployed to stack dissertation-editor-backend-dev
endpoints:
POST - https://jwfqmc0638.execute-api.us-east-1.amazonaws.com/intake/presigned-url
POST - https://jwfqmc0638.execute-api.us-east-1.amazonaws.com/intake/submit
GET - https://jwfqmc0638.execute-api.us-east-1.amazonaws.com/intake/submission/{submissionId}
GET - https://jwfqmc0638.execute-api.us-east-1.amazonaws.com/token
POST - https://jwfqmc0638.execute-api.us-east-1.amazonaws.com/webhooks/pipedrive
functions:
getPresignedUrl: dissertation-editor-backend-dev-getPresignedUrl
submitIntake: dissertation-editor-backend-dev-submitIntake
processSubmission: dissertation-editor-backend-dev-processSubmission
...
A full deploy typically takes 1-3 minutes.
Single Function Deployment
When only Lambda code has changed (no infrastructure changes), deploy a single function for faster iteration:
AWS_SDK_LOAD_CONFIG=1 npx serverless deploy function \
--function submitIntake \
--aws-profile dissertation-editor
This updates only the Lambda code and skips CloudFormation, completing in about 10 seconds.
When to use single function deploy:
- You changed only the handler code in one function
- No changes to
serverless.yml(no new environment variables, IAM permissions, or event mappings)
When to use full deploy:
- You changed
serverless.yml - You added or removed a function
- You changed IAM permissions, environment variables, or resource definitions
Verify the Deployment
After deploying, verify the endpoints are working:
# Test the presigned URL endpoint
curl -X POST https://jwfqmc0638.execute-api.us-east-1.amazonaws.com/intake/presigned-url \
-H "Content-Type: application/json" \
-d '{"fileName": "test.docx"}'
You should receive a JSON response with uploadUrl, s3Key, and submissionId.
Check CloudWatch Logs
View recent logs for a specific function:
AWS_SDK_LOAD_CONFIG=1 npx serverless logs \
--function submitIntake \
--aws-profile dissertation-editor
Tail logs in real time:
AWS_SDK_LOAD_CONFIG=1 npx serverless logs \
--function submitIntake \
--tail \
--aws-profile dissertation-editor
Rollback
If a deployment introduces a bug, roll back to the previous version:
Step 1: List Previous Deployments
AWS_SDK_LOAD_CONFIG=1 npx serverless deploy list \
--aws-profile dissertation-editor
This shows timestamps of previous deployments.
Step 2: Roll Back to a Specific Timestamp
AWS_SDK_LOAD_CONFIG=1 npx serverless rollback \
--timestamp 2026-03-09T14:30:00.000Z \
--aws-profile dissertation-editor
This restores the entire CloudFormation stack (all functions and resources) to the state at that timestamp.
Step 3: Verify the Rollback
Test the endpoints again and check CloudWatch logs to confirm the rollback resolved the issue.
Troubleshooting Deploys
| Problem | Solution |
|---|---|
ServerlessError: Access Denied |
Check that the dissertation-editor profile has the correct role ARN and permissions |
The security token included in the request is expired |
Run aws sts get-caller-identity --profile dissertation-editor to refresh credentials |
CloudFormation stack in ROLLBACK_COMPLETE state |
Delete the stack manually in the CloudFormation console, then redeploy |
An error occurred: XyzLambdaFunction - Resource limit exceeded |
You may have hit the Lambda storage limit. Delete old function versions. |