Hey guys! Loving the dev experience using resend but I came across some weird behaviour.
I tested resend locally and within the firebase emulators and it sends fine. However, when I deploy to firebase functions (2nd gen), I get this axios error when calling resend.sendEmail
and for some reason the baseUrl
has been switched to localhost:3001
.
AxiosError: connect ECONNREFUSED 127.0.0.1:3001
at Function.AxiosError.from (/workspace/node_modules/axios/dist/node/axios.cjs:836:14)
at RedirectableRequest.handleRequestError (/workspace/node_modules/axios/dist/node/axios.cjs:3010:25)
at RedirectableRequest.emit (node:events:513:28)
at RedirectableRequest.emit (node:domain:489:12)
at ClientRequest.eventHandlers.<computed> (/workspace/node_modules/follow-redirects/index.js:14:24)
at ClientRequest.emit (node:events:513:28)
at ClientRequest.emit (node:domain:489:12)
at Socket.socketErrorListener (node:_http_client:494:9)
at Socket.emit (node:events:513:28)
at Socket.emit (node:domain:489:12) {
port: 3001,
address: '127.0.0.1',
syscall: 'connect',
code: 'ECONNREFUSED',
errno: -111,
config: {
transitional: {
silentJSONParsing: true,
forcedJSONParsing: true,
clarifyTimeoutError: false
},
adapter: [ 'xhr', 'http' ],
transformRequest: [ [Function: transformRequest] ],
transformResponse: [ [Function: transformResponse] ],
timeout: 0,
xsrfCookieName: 'XSRF-TOKEN',
xsrfHeaderName: 'X-XSRF-TOKEN',
maxContentLength: Infinity,
maxBodyLength: Infinity,
env: { FormData: [Function], Blob: null },
validateStatus: [Function: validateStatus],
headers: AxiosHeaders {
Accept: 'application/json, text/plain, */*',
'Content-Type': 'application/json',
Authorization: 'Bearer re_BbYfmi5q_2wh2VCQMhyEpwFHq1hXp67vw',
'User-Agent': 'node:0.15.4',
'Content-Length': '9784',
'Accept-Encoding': 'gzip, compress, deflate, br'
},
baseURL: 'http://localhost:3001',
method: 'post',
url: 'http://localhost:3001/email',
data: `{"from":"[email protected]","to":"[email protected]","subject":"You're on the waitlist!","html":"<!DOCTYPE html PUBLIC \\"-//W3C//DTD XHTML 1.0 Transitional//EN\\" \\"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\\"><html lang=\\"en\\"><head data-id=\\"__react-email-head\\"><meta http-equiv=\\"Content-Type\\" content=\\"text/html; charset=UTF-8\\"/></head><div id=\\"__react-email-preview\\" style=\\"display:none;overflow:hidden;line-height:1px;opacity:0;max-height:0;max-width:0\\">The wait has begun!<div> βββββο»Ώ βββββο»Ώ βββββο»Ώ βββββο»Ώ βββββο»Ώ βββββο»Ώ βββββο»Ώ βββββο»Ώ βββββο»Ώ βββββο»Ώ βββββο»Ώ βββββο»Ώ βββββο»Ώ βββββο»Ώ βββββο»Ώ βββββο»Ώ βββββο»Ώ βββββο»Ώ βββββο»Ώ βββββο»Ώ βββββο»Ώ βββββο»Ώ βββββο»Ώ βββββο»Ώ βββββο»Ώ βββββο»Ώ βββββο»Ώ βββββο»Ώ βββββο»Ώ βββββο»Ώ βββββο»Ώβ¦ [message truncated due to size]