验证器报告 !If 函数的配置无效
service: ${env:SERVICE_NAME} frameworkVersion: '3' plugins: - serverless-domain-manager - serverless-offline params: default: apiBasePath: ${env:API_VERSION}-${env:ENV} authSubdomain: ${env:AUTH_SUBDOMAIN_TOKEN}-${env:API_VERSION}-${env:ENV} prod: apiBasePath: ${env:API_VERSION} authSubdomain: ${env:AUTH_SUBDOMAIN_TOKEN}-${env:API_VERSION} provider: apiGateway: disableDefaultEndpoint: true apiName: ${self:provider.stackName} endpointType: EDGE iam: role: # name: statements: - Effect: Allow Action: - cognito-idp:AdminInitiateAuth - cognito-idp:AdminCreateUser - cognito-idp:AdminSetUserPassword Resource: '*' memorySize: 128 name: AWS region: us-east-1 runtime: nodejs18.x stackName: ${env:SERVICE_NAME}-${env:API_VERSION}-${env:ENV} stage: ${env:API_VERSION}-${env:ENV} timeout: 5 custom: customDomain: domainName: ${env:API_SUBDOMAIN}.${env:ROOT_DOMAIN} basePath: ${param:apiBasePath} certificateArn: ${env:CERTIFICATE_ARN} functions: hello: handler: api/open/hello.get description: GET /hello events: - http: path: hello method: get cors: true # name: ${self:provider.stage} secure-hello: handler: api/secure/hello.get description: GET /secure-hello events: - http: path: secure-hello method: get cors: true authorizer: name: UserPoolAuthorizer type: COGNITO_USER_POOLS arn: !If CreateUserPool, !GetAtt UserPool.Arn, ${env:COGNITO_USER_POOL_ARN} claims: - email resources: Conditions: CreateUserPool: !Equals ['${env:COGNITO_USER_POOL_ARN}', '*'] CreateIdentityProviderGoogle: !And CreateUserPool, !Not !Or Equals ['${env:GOOGLE_CLIENT_ID}', '*'], Equals ['${env:GOOGLE_CLIENT_SECRET}', '*'] Resources: GatewayResponseDefault4XX: Type: 'AWS::ApiGateway::GatewayResponse' Properties: ResponseParameters: gatewayresponse.header.Access-Control-Allow-Origin: "*" gatewayresponse.header.Access-Control-Allow-Headers: "*" ResponseType: DEFAULT_4XX …
内容来源: serverless/serverless