const pg = require('pg');
const connectionString = process.env.DATABASE_URL || 'postgres://un:pass@localhost:5432/postgres';
const client = new pg.Client(connectionString);
client.connect();
const query = client.query('CREATE TABLE items(id SERIAL PRIMARY KEY, text VARCHAR(40) not null, complete BOOLEAN)');
query.on('end', () => { client.end(); });
textPayload: "MalformedResponse: Webhook error (206)"
有人有什么建议给我吗?谢谢!
以下是日志的摘录:
7:10:03.013 PM
dialogflowFirebaseFulfillment
Ignoring exception from a finished function
7:10:02.995 PM
dialogflowFirebaseFulfillment
Function execution took 10 ms, finished with status code: 200
7:10:02.986 PM
dialogflowFirebaseFulfillment
Billing account not configured. External network is not accessible and quotas are severely limited. Configure billing account to remove these restrictions
7:10:02.986 PM
dialogflowFirebaseFulfillment
Function execution started
7:09:49.540 PM
dialogflowFirebaseFulfillment
Ignoring exception from a finished function
7:09:48.543 PM
dialogflowFirebaseFulfillment
Function execution took 865 ms, finished with status code: 200
7:09:47.678 PM
dialogflowFirebaseFulfillment
Billing account not configured. External network is not accessible and quotas are severely limited. Configure billing account to remove these restrictions
7:09:47.678 PM
dialogflowFirebaseFulfillment
Function execution started
7:09:12.659 PM
dialogflowFirebaseFulfillment
Warning, estimating Firebase Config based on GCLOUD_PROJECT. Initializing firebase-admin may fail
7:08:41.442 PM
dialogflowFirebaseFulfillment
Warning, estimating Firebase Config based on GCLOUD_PROJECT. Initializing firebase-admin may fail
7:04:51.279 PM
dialogflowFirebaseFulfillment
Ignoring exception from a finished function
7:04:51.238 PM
dialogflowFirebaseFulfillment
Function execution took 896 ms, finished with status code: 200
7:04:50.343 PM
dialogflowFirebaseFulfillment
Billing account not configured. External network is not accessible and quotas are severely limited. Configure billing account to remove these restrictions
7:04:50.343 PM
dialogflowFirebaseFulfillment
Function execution started
7:04:33.195 PM
dialogflowFirebaseFulfillment
Warning, estimating Firebase Config based on GCLOUD_PROJECT. Initializing firebase-admin may fail
我最近在这里写了关于用Dialogflow连接MongoDB的文章。
正如我之前所说的,您将无法连接到运行在localhost:5432上的Postgres的本地实例(localhost:8080上的MySQL也无法连接到本地实例)。您必须使用托管的Postgres服务,如ElepantSQL(除了Firebase/FireStore之外,其他数据库也可以使用)
现在转向您的答案,首先,认真对待这条日志消息是很重要的:
'use strict';
const functions = require('firebase-functions');
const {WebhookClient} = require('dialogflow-fulfillment');
const {Card, Suggestion} = require('dialogflow-fulfillment');
const pg = require('pg');
const connectionString = process.env.DATABASE_URL || 'postgres://fsdgubow:K4R2HEcfFeYHPY1iLYvwums3oWezZFJy@stampy.db.elephantsql.com:5432/fsdgubow';
const client = new pg.Client(connectionString);
client.connect();
//const query = client.query('CREATE TABLE items(id SERIAL PRIMARY KEY, text VARCHAR(40) not null, complete BOOLEAN)');
});
process.env.DEBUG = 'dialogflow:debug'; // enables lib debugging statements
exports.dialogflowFirebaseFulfillment = functions.https.onRequest((request, response) => {
const agent = new WebhookClient({ request, response });
console.log('Dialogflow Request headers: ' + JSON.stringify(request.headers));
console.log('Dialogflow Request body: ' + JSON.stringify(request.body));
function welcome(agent) {
const text = 'INSERT INTO items(text, complete) VALUES($1, $2) RETURNING *'
const values = ['some item text', '1' ]
// insert demo in your items database
client.query(text, values)
.then(res => {
console.log(res.rows[0])
//see log for output
})
.catch(e => console.error(e.stack))
// sample query returning current time...
return client.query('SELECT NOW() as now')
.then((res) => {
console.log(res.rows[0]);
agent.add(`Welcome to my agent! Time is ${res.rows[0].now}!`);
})
.catch(e => console.error(e.stack))
}
function fallback(agent) {
agent.add(`I didn't understand`);
agent.add(`I'm sorry, can you try again?`);
}
// Run the proper function handler based on the matched Dialogflow intent name
let intentMap = new Map();
intentMap.set('welcome', welcome);
intentMap.set('Default Fallback Intent', fallback);
// intentMap.set('your intent name here', yourFunctionHandler);
// intentMap.set('your intent name here', googleAssistantHandler);
agent.handleRequest(intentMap);
});
ElepantSQL控制台
火场日志
谷歌助手
问题内容: 我有一个空白的Spring MVC项目,并且已经使用Maven安装了Hibernate和PostgreSQL驱动程序。 我正在用完整的教程讲解如何显示PostgreSQL与Hibernate的连接。 这里有什么帮助吗? 问题答案: 这是posgresql的hibernate.cfg.xml,它将帮助您使用posgresql的基本hibernate配置。
本文向大家介绍postgresql 数据库 与TimescaleDB 时序库 join 在一起,包括了postgresql 数据库 与TimescaleDB 时序库 join 在一起的使用技巧和注意事项,需要的朋友参考一下 之前在CSDN阅读资料时,发现有人问怎么把 postgresql数据库 的表 跟TimescaleDB 时序库的表 join在一起,正好我在查询数据的时候遇到过这个问题 ,我说
我正在尝试将PostgreSQL数据库连接到pgadmin。 我所掌握的关于数据库的唯一信息是: postgres:/candidate.company.org/company 用户名:banana 密码:AAABBBCCC 无法将主机名“postgres://candidate.company.org/company”转换为地址:nodename或servname已提供或未知
我想将一个基于Qurkus/Hibernate的应用程序连接到一个运行在Google Cloud中的复制PostgreSQL实例。这种复制假设有一个写实例和几个读副本。 我浏览了古尔库斯文档,但找不到一种方法。有一种方法可以为不同的数据库设置多个数据源,但这不是我需要的。 问题:如何在Quarkus中配置读/写DB实例? 我正在使用。
我有一个IP地址每次我收到连接失败的消息时,我都尝试了很多连接到该服务器的方法。出于安全原因,我隐藏了用户名和密码。 代码: 我有例外 组织。postgresql。util。PSQLException:连接尝试失败。在org。postgresql。果心v3。连接工厂impl。org上的openConnectionImpl(ConnectionFactoryImpl.java:292)。postgr
问题内容: 直到现在,每当查询数据库时,我都会打开与数据库的新连接。如何实现打开连接后就可以重用的属性? 完成此操作后,请告诉我是否可以泄漏资源。 问题答案: 基本上,您需要JDBC连接池,通常需要实现接口。看看dbcp和c3p0。您的容器/服务器可能已经提供了连接池的实现。 每次 打开 连接时使用连接池时,实际上是从该连接中取出一个连接(如果池为空则 打开 一个连接)。当 关闭 连接时,它实际上