Tag: 无服务器架构

使用Azure无服务器函数req.body返回HTML

Azure Blob存储中有一些TIF文件。 我想通过embedded在电子表格中的链接在浏览器中显示它们。 最简单的方法应该是将文件代码作为请求参数,并返回格式正确的HTML,对吧? 所以现在我已经得到了一些HTML的req.body。 不幸的是,HTML只是在浏览器中显示为一个string。 我如何使它尽可能呈现为HTML格式? 这是我的代码: if (req.query.blob) { let blob = req.query.blob; context.res = { // status: 200, /* Defaults to 200 */ body: `<object width=200 height=200 data="<baseaddress>/${blob}.tif" type="image/tiff"> <param name="src" value="<baseaddress>/${blob}.tif"> <param name="negative" value="yes"> </object>` }; }

aws + serverless + webpack =>在prod中找不到xxx模块

我想创build一个包,使用无服务器和webpack在AWS上进行部署。 在serverless.yml我想声明所有的资源(主要是DynamoDb表)和函数。 我想要使​​用外部的node.js库。 该文件夹结构是: |- serverless.yml |- webpack.config.js |- package.json |- src \ – file1.js | – file2.js 从serverless.yml中提取 functions: function1: handler: src/file1.f1 function2: handler: src/file2.f2 从webpack.congfig.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: […]

无法在Visual Studio代码中debugging无服务器应用程序

我曾尝试debugging在VS代码中使用无服务器框架开发的无服务器应用程序。 我跟着这篇文章。 但是当我试图debugging代码时,我得到了如下VS代码的错误。 无法启动程序'g:\ Projects \ Serverless1 \ node_modules.bin \ sls'; 设置'outDir或outFiles'属性可能会有所帮助。 sls命令文件已经存在于该文件夹中,以下是launch.json文件设置 "version": "0.2.0", "configurations": [ { "type": "node", "request": "launch", "protocol": "inspector", "name": "run hello function", "program": "${workspaceRoot}\\node_modules\\.bin\\sls", "args": [ "invoke", "local", "-f", "hello", "–data", "{}" ] } ] 请帮我解决这个问题。

AWS Lamba在使用RDS时性能较差

我已经使用无服务器框架实现了AWS Lambda函数。 该Lambda函数正在使用RDS和MongoDB。 MongoDB端点运行大约500ms,但RDS在12秒(冷启动)和〜3秒(热启动)运行。 注意:我在这个端点使用了Sequelize。 如何加速我的RDS Lambda端点?