npm install chrome-aws-lambda我的代码在本地运行时工作正常,我在部署之前安装了该模块,并尝试chmod -R +r node_modules/以防它是读取权限错误,但仍然没有运气。
我的 handler.js 代码:
'use strict';
const {getArrayOfPages} = require("./utils");
const creds = require("./creds.json");
module.exports.hello = async (event, context) => {
try {
var browserendpoint = await getArrayOfPages(creds.username, creds.password)
console.log("DATA: " + browserendpoint)
}
catch(error) {
// Code that handles any potential errors
console.log(error)
}
}
Run Code Online (Sandbox Code Playgroud)
我的 getArrayOfPages.js 代码:
const sign_in = 'www.example.com/';
const chromium = require('chrome-aws-lambda')
module.exports = async function (username, password) {
try {
browser = await chromium.puppeteer.launch({
args: chromium.args, …Run Code Online (Sandbox Code Playgroud) 我想将我的working表的更改记录到我的history表中,但仅当值在 UPDATE 期间发生更改时,我尝试创建一个 update_history 触发器,但无论值是否已更改,它都会添加一行,例如说我有这在我的工作表中:
shift_id|site |organisational_unit
--------|---------|-------------------
123475|site01 |my org
Run Code Online (Sandbox Code Playgroud)
如果我执行更新查询
UPDATE working SET site = $1, organisational_unit = $2 WHERE shift_id=$3', ['site01', 'my new org', '123475']
Run Code Online (Sandbox Code Playgroud)
这会在历史记录表中创建一行,因为site 它甚至认为它没有更改值我只想要一个新行用于组织单元更改
historyid|shiftid|fieldname |oldvalue |newvalue |updatedat |
---------|-------|-------------------|---------|-----------|-------------------|
7| 123475|organisational_unit|my org |my new org |2019-07-01 10:21:19|
8| 123475|site |site01 |site01 |2019-07-01 10:21:19|
Run Code Online (Sandbox Code Playgroud)
我的触发器看起来像这样
-- create function for updates to track history
CREATE function update_history ()
RETURNS TRIGGER
as $$
BEGIN
-- check if data in column has …Run Code Online (Sandbox Code Playgroud)