因此,我正在尝试将现有的spring boot应用程序转换为AWS lambda并使用SAM。
我正在尝试使用aws-sam-cli在本地尝试我的lambda,但是通过我的SAM设置我得到了: Template does not have any APIs connected to Lambda functions
当我做: sam local start-api
我的template.yml:
AWSTemplateFormatVersion : '2010-09-09'
Transform: AWS::Serverless-2016-10-31
Description: foo
Resources:
MailFunction:
Type: AWS::Serverless::Function
Properties:
Handler: bar.LambdaHandler::handleRequest
Runtime: java8
CodeUri: target/foo-bar-1.0.jar
Timeout: 300
MemorySize: 1024
Events:
Timer:
Type: Schedule
Properties:
Schedule: rate(1 day)
Run Code Online (Sandbox Code Playgroud)
知道我在做什么错吗?据我从https://blog.couchbase.com/aws-serverless-lambda-scheduled-events-tweets-couchbase/ + https://docs.aws.amazon.com/lambda/latest所知,它看起来是正确的/dg/tutorial-scheduled-events-schedule-expressions.html
当我尝试部署AWS SAM YAML文件时,它无法显示!Ref是未知标签。
有什么想法可以解决吗?
AWSTemplateFormatVersion: '2010-09-09'
Transform: AWS::Serverless-2016-10-31
Resources:
MySimpleFunction:
Type: AWS::Serverless::Function
Properties:
Handler: index.handler
Runtime: nodejs4.3
CodeUri: s3://<bucket>/MyCode.zip
Events:
MyUploadEvent:
Type: S3
Properties:
Id: !Ref Bucket
Events: Create
Bucket:
Type: AWS::S3::Bucket
Run Code Online (Sandbox Code Playgroud) 我正在尝试使用无服务器部署 python lambda 函数。我需要 psycopg2 库,因此我使用了 serverless-python-requirements 插件并将其添加到我的 serverless.yml 文件中。
plugins:
- serverless-python-requirements
custom:
pythonRequirements:
dockerizePip: non-linux
Run Code Online (Sandbox Code Playgroud)
我可以成功部署该功能:
Serverless: Installing requirements from
/Users/Desktop/postgresql/.serverless/requirements/requirements.txt ...
Serverless: Docker Image: lambci/lambda:build-python3.6
Serverless: Packaging service...
Serverless: Excluding development dependencies...
Serverless: Injecting required Python packages to package...
Serverless: Uploading CloudFormation file to S3...
Serverless: Uploading artifacts...
Serverless: Uploading service .zip file to S3 (43.07 MB)...
Serverless: Validating template...
Serverless: Updating Stack...
Serverless: Checking Stack update progress...
..............
Serverless: Stack update finished...
Run Code Online (Sandbox Code Playgroud)
但是当我检查我的 Cloudwatch 日志时,它说“没有名为‘psycopg2’的模块”。
我的 …
我正在尝试从本地计算机在 AWS 上部署无服务器应用程序。该计算机位于公司防火墙后面。
最初,我收到连接错误,因此我在终端上添加了 http_proxy 和 https_proxy 设置。
现在,当我尝试部署时,我不断在证书链中收到错误的自签名证书。
我还从 puttygen 创建了一个证书并将 npm ca 文件路径设置为它,但一切都是徒劳的。
我的 npm 安装有效,唯一的问题是无服务器部署。
不知道下一步该怎么做。
已经感谢您的帮助了。

如果有帮助的话,我已经添加了图像的屏幕截图。
node.js aws-sdk aws-lambda serverless-framework aws-serverless
我有一个存储库,在 github 上托管我的 lambda 函数。我希望每当新逻辑被推送到掌握时都能够部署新版本。
我做了很多研究,发现了一些不同的方法,但没有什么真正清楚的。想知道其他人认为最好的方法是什么,也许还有一些关于如何设置管道的细节(如果可能)。
谢谢
aws-code-deploy aws-lambda aws-codepipeline aws-codebuild aws-serverless
任何人都可以帮助我如何使用 PHP laravel 将文件上传到 aws S3 存储桶。但文件应该使用预签名 URL 直接上传到 S3。
在 serverless.yml 中,在自定义下,我有以下代码(此处带有虚拟值):
customDomain:
domainName: myhost.mydomain.com
basePath: ''
stage: ${self:provider:stage}
createRouteS3Record: true
endpointType: 'edge'
securityPolicy: tls_1_2
certificateArn: 'arn:aws:acm:.................'
hostZoneId: 'P4OCK4S1PSTZK'
Run Code Online (Sandbox Code Playgroud)
当我执行无服务器部署时,一切都很顺利。为我的函数正确生成了 Api。(在我拥有的功能下events: http)
但是,在部署 API 生成的 lambda 后,我收到以下错误:
Error: Error: Unable to setup base domain mappings for myhost.mydomain.com
Run Code Online (Sandbox Code Playgroud)
除了https://forum.serverless.com/t/error-unable-to-setup-base-domain-mappings/11395之外,我没有得到太多信息 不知道如何在无服务器中包含 api 版本(如果这是解决方案) 。
amazon-web-services aws-api-gateway serverless custom-domain aws-serverless
我正在尝试使用查询和 JSON 模式获取所有记录,但除非我Event object failed validation传递查询,否则我会不断获取它不会给我任何结果。status=OPEN
我正在尝试获取设置了默认值的所有记录status=OPEN,但看起来默认值正在工作。除非我将其status=OPEN作为查询传递,请帮助我!
并用于@middy/validator此案例任何人都已经两天了我仍然无法弄清楚问题
const getAuctionsSchema = {
type: 'object',
required: ['queryStringParameters'],
properties: {
queryStringParameters: {
type: 'object',
required: ['status'],
properties: {
status: {
default: 'OPEN',
enum: ['OPEN', 'CLOSED'],
},
},
},
},
};
module.exports = getAuctionsSchema;
Run Code Online (Sandbox Code Playgroud)
const AWS = require('aws-sdk');
const createError = require('http-errors');
const validator = require('@middy/validator');
const commonMiddleware = require('../lib/commonMiddleware');
const getAuctionsSchema = require('../lib/schemas/getAuctionsSchema');
const dynamoDB = new AWS.DynamoDB.DocumentClient();
const get_auctions …Run Code Online (Sandbox Code Playgroud) 错误:
\nRunning "serverless" from node_modules\n\nDeploying serverless-flask to stage dev (us-east-1)\n\n\xe2\x9c\x96 Stack serverless-flask-dev failed to deploy (0s)\nEnvironment: darwin, node 16.0.0, framework 3.1.1 (local) 3.1.1v (global), plugin 6.0.0, SDK 4.3.1\nCredentials: Local, "default" profile\nDocs: docs.serverless.com\nSupport: forum.serverless.com\nBugs: github.com/serverless/serverless/issues\n\nError:\nError: spawn docker ENOENT\n at Process.ChildProcess._handle.onexit (node:internal/child_process:282:19)\n at onErrorNT (node:internal/child_process:480:16)\n at processTicksAndRejections (node:internal/process/task_queues:83:21)\nRun Code Online (Sandbox Code Playgroud)\n我正在遵循这些说明(https://www.serverless.com/blog/flask-python-rest-api-serverless-lambda-dynamodb/),并且似乎无法弄清楚这一点,因为基本应用程序是在 python 而不是 javascript 中......大多数解决这个问题的人都使用 javascript 解决了它。
\npython node.js python-3.x serverless-framework aws-serverless
我无法使用无服务器框架加载位于自定义路径中的环境文件。
env 文件保存在项目中的“config/environment”文件夹中,可用的文件是
Serverless.yml内容如下
plugins:
- serverless-dotenv-plugin
custom:
stage: ${opt:stage, "dev"}
dotenv:
basePath: ./config/environment/
logging: false
Run Code Online (Sandbox Code Playgroud)
触发“无服务器部署”时,出现如下错误
无法解析 serverless.yml:变量解析出错:
- 无法解析“provider.xxxxxx”处的变量:在“env”源中找不到值,
- 无法解析“provider.xxxxxx”处的变量:在“env”源中找不到值,
- 无法解析“provider.xxxxxx”处的变量:在“env”源中找不到值,
- 无法解析“provider.xxxxxx”处的变量:在“env”源中找不到值,
- 无法解析“provider.xxxxxx”处的变量:在“env”源中找不到值,
似乎 .env 文件没有被加载,任何帮助将不胜感激。
aws-serverless ×10
serverless ×4
aws-lambda ×3
node.js ×3
aws-sdk ×2
python ×2
amazon-s3 ×1
aws-sam ×1
laravel ×1
psycopg2 ×1
python-3.x ×1
yaml ×1