[英]Azure Function timing out or erroring when trying to write to local filesystem
[英]Requests to nodejs server deployed on Azure App Service timing out when trying to access Azure Postgres flexible database
我在 Azure App Services 上部署了一個 node.js Express 服務器,它連接到一個 Azure 靈活的 postgresql 數據庫來處理請求。 在本地運行服務器時,postgres 數據庫可以正常訪問數據庫,但是當服務器部署到 azure 應用程序服務時,所有請求都超時:
服務器使用池來發出請求,這是我的服務器配置文件的樣子:
const {Pool} = require('pg');
require('dotenv').config();
const config = {
host: process.env.HOST,
user: process.env.USER,
password: process.env.PASSWORD,
database: process.env.DB_NAME,
port: process.env.PORT,
ssl: true,
max: 50,
idleTimeoutMillis: 10000,
allowExitOnIdle: true,
}
module.exports = new Pool(config);
到目前為止,我已經嘗試過:
但是這些解決方案都沒有阻止請求超時,因此我們將不勝感激任何幫助。
謝謝
謝天謝地,我找到了解決這個問題的方法!
我懷疑 Azure App Service 將 PORT env 變量覆蓋為 8080,因此在嘗試連接時用於連接到數據庫的端口變量最終是錯誤的。
我已將 .env 變量重命名為其他名稱,現在它可以正常工作了。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.