mirror of
https://github.com/OpenSignLabs/OpenSign.git
synced 2026-08-25 00:52:34 +02:00
fix: getaddrinfo ENOTFOUND while creating admin
This commit is contained in:
@@ -2,6 +2,7 @@ import axios from 'axios';
|
||||
import { google } from 'googleapis';
|
||||
import fs from 'node:fs';
|
||||
import https from 'https';
|
||||
import http from 'http';
|
||||
const clientId = process.env.GOOGLE_CLIENT_ID;
|
||||
const clientSecret = process.env.GOOGLE_CLIENT_SECRET;
|
||||
// Function to create a Gmail client
|
||||
@@ -34,10 +35,17 @@ const makeEmail = async (to, from, subject, html, url, pdfName) => {
|
||||
let Pdf = fs.createWriteStream('test.pdf');
|
||||
const writeToLocalDisk = () => {
|
||||
return new Promise((resolve, reject) => {
|
||||
https.get(url, async function (response) {
|
||||
response.pipe(Pdf);
|
||||
response.on('end', () => resolve('success'));
|
||||
});
|
||||
if (useLocal !== 'true') {
|
||||
https.get(url, async function (response) {
|
||||
response.pipe(Pdf);
|
||||
response.on('end', () => resolve('success'));
|
||||
});
|
||||
} else {
|
||||
http.get(url, async function (response) {
|
||||
response.pipe(Pdf);
|
||||
response.on('end', () => resolve('success'));
|
||||
});
|
||||
}
|
||||
});
|
||||
};
|
||||
// `writeToLocalDisk` is used to create pdf file from doc url
|
||||
@@ -130,7 +138,7 @@ export default async function sendMailGmailProvider(_extRes, template) {
|
||||
raw: email,
|
||||
},
|
||||
});
|
||||
// console.log('response ', response);
|
||||
// console.log('response ', response);
|
||||
|
||||
return { code: 200, message: 'Email sent successfully' };
|
||||
} catch (error) {
|
||||
|
||||
Reference in New Issue
Block a user