我试图删除GET
我在 AWS API Gateway 上手动创建的测试资源,但它删除了我POST
在同一资源路径中的资源,现在当我sls deploy
的 lambda 资源没有返回 API Gateway 的资源列表时:
functions:
updateLibrary:
environment:
...
handler: updates/lambda.handler
events:
- http:
path: library/updated
method: post
private: true
缺少library/updated
POST
资源
使用资源的开发阶段的旧部署是什么样的library/updated
POST
:
sls deploy
日志的结果:
Serverless: Stack update finished...
Serverless: Invoke aws:info
Serverless: [AWS cloudformation 200 0.484s 0 retries] describeStacks({ StackName: '***********-********-***' })
Serverless: [AWS cloudformation 200 0.508s 0 retries] listStackResources({ StackName: '***********-********-***' })
Service Information
service: ***********-********
stage: dev
region: **-****-*
stack: ***********-********-***
resources: 26
api keys:
None
endpoints:
POST - https://**********.execute-api.**-****-*.amazonaws.com/dev/library/updated
POST - https://**********.execute-api.**-****-*.amazonaws.com/dev/merge/approved
functions:
updateLibrary: ***********-********-***-updateLibrary
mergePR: ***********-********-***-mergePR
layers:
None
Serverless: [AWS sts 200 0.452s 0 retries] getCallerIdentity({})
Serverless: [AWS apigateway 200 0.633s 0 retries] getRestApis({ position: undefined, limit: 500 })
Serverless: [AWS apigateway 200 0.404s 0 retries] getStage({ restApiId: '**********', stageName: 'dev' })
Serverless: [AWS apigateway 200 0.577s 0 retries] updateStage({ restApiId: '**********',
stageName: 'dev',
patchOperations:
[ { op: 'replace',
path: '/accessLogSettings/destinationArn',
value: 'arn:aws:logs:**-****-*:**************:log-group:/aws/api-gateway/***********-********-***' },
{ op: 'replace',
path: '/accessLogSettings/format',
value: '{"requestTime":"$context.requestTime","requestId":"$context.requestId","apiId":"$context.apiId","resourceId":"$context.resourceId","resourcePath":"$context.resourcePath","path":"$context.path","httpMethod":"$context.httpMethod","status":"$context.status","authLatency":"$context.authorizer.integrationLatency","integrationLatency":"$context.integrationLatency","integrationStatus":"$context.integrationStatus","responseLatency":"$context.responseLatency","responseLength":"$context.responseLength","errorMessage":"$context.error.message","format":"SLS_ACCESS_LOG","version":"1.0.0"}' },
{ op: 'replace', path: '/*/*/logging/dataTrace', value: 'true' },
{ op: 'replace', path: '/*/*/logging/loglevel', value: 'INFO' },
[length]: 4 ] })
Serverless: Invoke aws:deploy:finalize
Serverless: [AWS s3 200 0.511s 0 retries] listObjectsV2({ Bucket: '***********-********-***-serverlessdeploymentbucket-**************',
Prefix: 'serverless/***********-********/dev' })
Serverless: Removing old service artifacts from S3...
Serverless: [AWS s3 200 0.503s 0 retries] deleteObjects({ Bucket: '***********-********-***-serverlessdeploymentbucket-**************',
Delete:
{ Objects:
[ { Key: 'serverless/***********-********/dev/******************-2020-02-09T03:31:30.226Z/***********-********.zip' },
{ Key: 'serverless/***********-********/dev/******************-2020-02-09T03:31:30.226Z/compiled-cloudformation-template.json' },
{ Key: 'serverless/***********-********/dev/******************-2020-02-09T03:31:30.226Z/custom-resources.zip' },
[length]: 3 ] } })
Serverless: Publishing service to the Serverless Dashboard...
Serverless: [AWS sts 200 0.432s 0 retries] getCallerIdentity({})
Serverless: [AWS cloudformation 200 0.49s 0 retries] describeStacks({ StackName: '***********-********-***' })
platform-sdk fetching: POST https://api.serverless.com/core/tenants/********/applications/******-*****-*******/services/***********-********/stages/dev/regions/**-****-*/deployments
Serverless: Successfully published your service to the Serverless Dashboard: https://dashboard.serverless.com/tenants/********/applications/******-*****-*******/services/***********-********/stage/dev/region/**-****-*
我看到:
patchOperations:
[ { op: 'replace'
在这些日志中,也许它只是尝试执行更新操作而不是尝试再次创建资源,因为它认为已经存在。我试过sls deploy --force
但结果相同。