我是耐用函数(编排函数)的新手,并且根据Microsoft文档查看了示例应用程序。因此,我对此毫不怀疑。
例:
public static async Task<HttpResponseMessage> Run(
[HttpTrigger(AuthorizationLevel.Anonymous, methods: "post",
Route = "orchestrators/{functionName}")] HttpRequestMessage req,
[OrchestrationClient] DurableOrchestrationClient starter,
string functionName,
TraceWriter log)
{
// Function input comes from the request content.
dynamic eventData = await req.Content.ReadAsAsync<object>();
string instanceId = await starter.StartNewAsync(functionName, eventData);
log.Info($"Started orchestration with ID = '{instanceId}'.");
return starter.CreateCheckStatusResponse(req, instanceId);
}
Run Code Online (Sandbox Code Playgroud)
要调用它,我使用邮递员发出了HTTP POST请求,因此请求已成功处理,但是当我在控制台中配置了不同的动词(如HTTP GET)时,它在控制台中响应为NotFound”,以及浏览器对HTTP请求的请求中均响应了“ NotFound”错误在控制台中。为什么会这样?
我可以使用in计时器触发azure函数调用任何Orchestration函数吗?
如果不是为什么?
更新:
有关问题的一些其他详细信息
[FunctionName("TimerTrigger")]
public static async Task Run([TimerTrigger("0 */5 * * * *")]TimerInfo myTimer, TraceWriter log)
{//this runs for every 5minutes
using …Run Code Online (Sandbox Code Playgroud) 我有一个架构,其中我将 API 网关与 Cognito 用户池授权程序一起使用,并且我从客户端 ReST 调用传递授权标头中的 IdToken。
它运行良好。
我需要 Lambda 中的 cognitoIdentityId。
在 API 网关的集成请求中尝试了正文模板映射
内容类型 - application/json
{
"cognito-identity" : "$context.identity.cognitoIdentityId"
}
Run Code Online (Sandbox Code Playgroud)
它不会发送identityid(在事件中或上下文中),而且它仅将我的有效负载转换为这个json。
在这种情况下,如何在 Lambda 中获取 IdentityID 并保持我的有效负载完好无损?
lambda amazon-cognito aws-api-gateway serverless-architecture
我使用无服务器框架来使用以下 CloudFormation 配置创建 Cognito 用户池:
Resources:
CognitoUserPool:
Type: AWS::Cognito::UserPool
Properties:
# Generate a name based on the stage
UserPoolName: ${opt:stage}-user-pool
# Set email as an alias
UsernameAttributes:
- email
AutoVerifiedAttributes:
- email
MfaConfiguration: OFF
EmailVerificationMessage: 'message here'
EmailVerificationSubject: 'subject here'
Policies:
PasswordPolicy:
MinimumLength: 6
RequireLowercase: true
RequireNumbers: false
RequireSymbols: true
RequireUppercase: true
Schema:
- AttributeDataType: String
DeveloperOnlyAttribute: false
Mutable: true
Name: address
Required: true
- AttributeDataType: String
DeveloperOnlyAttribute: false
Mutable: true
Name: email
Required: true
- AttributeDataType: String
DeveloperOnlyAttribute: false …Run Code Online (Sandbox Code Playgroud) amazon-web-services amazon-cognito serverless-framework serverless-architecture aws-serverless
我使用的是无服务器框架版本 2.11.0
尝试部署时,它抛出无服务器错误:
Configuration error at 'provider.logRetentionInDays': should be equal to one of the allowed values
Run Code Online (Sandbox Code Playgroud)
但它没有显示任何允许的值。同样在我的例子中,我给出的值为 90(整数)。我做错了什么吗?
serverless-framework serverless-architecture serverless aws-serverless serverless-application-model
有人可以通过示例解释如何计算 RPU 吗?
假设我有一个包含 500 万个文档的 mongo 集合。那么,如果我对集合执行findOne ,生成的 RPU 将是5M还是1?
我想创建一个包来使用AWS部署无服务器和的WebPack。
在serverless.yml我想声明所有资源(主要是 DynamoDb 表)和函数。我想使用外部node.js库。
文件夹结构为:
|- serverless.yml
|- webpack.config.js
|- package.json
|- src
\ - file1.js
| - file2.js
Run Code Online (Sandbox Code Playgroud)
摘自 serverless.yml
functions:
function1:
handler: src/file1.f1
function2:
handler: src/file2.f2
Run Code Online (Sandbox Code Playgroud)
摘自 webpack.config.js
module.exports = {
entry: {
file1: './src/file1.js',
file2: './src/file2.js',
},
target: 'node',
output: {
libraryTarget: 'commonjs',
path: path.join(__dirname, '.webpack'),
filename: '[name].js',
},
module: {
loaders: [
{
test: /\.json$/,
loaders: ['json-loader'],
},
],
},
};
Run Code Online (Sandbox Code Playgroud)
做当serverless deploy一切都很好,但测试时的λ我得到一个错误:
{
"errorMessage": "Cannot …Run Code Online (Sandbox Code Playgroud) amazon-web-services node.js webpack serverless-framework serverless-architecture
我有一个简单的Lambda函数,它通过SES发送电子邮件.我可以使用带有所需数据的POST请求来调用它,它会发送一封电子邮件.我的问题是,我可以用什么方法来保护这个功能?目前,任何人都可以调用该端点并使用任何数据执行该功能.
javascript aws-lambda aws-api-gateway serverless-framework serverless-architecture
我需要使用sharp包来调整Lambda函数中的图像大小,但它在我的Windows机器上执行"npm install"时会构建本机代码,这肯定不适用于托管Lambda的Amazon Linux服务器.
使用无服务器时,建议的解决方法是什么?
lambda aws-lambda serverless-framework serverless-architecture sharp
您好,我正在尝试使用无服务器执行以下操作:如果我没有提供选项,我希望它选择另一个选项
${opt:fb,${opt:environment,'dev'}}
Run Code Online (Sandbox Code Playgroud)
然而,有些事情是错误的,因为这个错误总是在我打电话时出现sls deploy:
A valid option to satisfy the declaration 'opt:fb,dev' could not be found.
Run Code Online (Sandbox Code Playgroud)
我不明白出了什么问题,因为显然它似乎正确选择了该值。能帮我一下吗?谢谢
serverless-framework serverless-architecture serverless aws-serverless
我尝试将我的应用程序从节点 16 更新到节点 18,完成更改版本后,我启动了我的应用程序并发送了 api 调用,并收到了以下输出。
\nWarning: found unsupported runtime 'nodejs18.x' for function 'rs-ms-v1'\n\xc3\x97 Unsupported runtime\nRun Code Online (Sandbox Code Playgroud)\n我们正在使用 serverless.yml 文件
\n我的无服务器库版本是3.33.0\ni检查了aws文档lambda函数开始支持nodejs18.x
\n请在下面附上您的解决方案。
\nnode.js aws-lambda serverless-framework serverless-architecture serverless
serverless ×4
aws-lambda ×3
lambda ×2
node.js ×2
azure ×1
javascript ×1
mongodb ×1
mongoose ×1
serverless-application-model ×1
sharp ×1
webpack ×1