-
Notifications
You must be signed in to change notification settings - Fork 17
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
send fails with "Response undefined: undefined" #53
Comments
Thanks, @zeevl . To make this easier to reproduce can you let me know what version of node you're running and include an example of the send call you're making? Thanks! |
Glad you asked, I suspect this might be part of the problem! We're promisifying Sendwithus so we can use it with async/await..
And this is running in node 12.x (whatever their current version is) in an AWS lambda function... |
I had the same issue when I updated from 4.3.1 to 4.3.3 to fix a build pipeline that broke when github turned off the unencrypted git protocol on November 2nd. I did not expect a patch version for this library to change a public API (I should have been more careful and skeptical). I suggest adding a blurb on your readme to alert developers of this. Github will have a few more brownouts in the next few months and will remove support for unencrypted git protocol completely next March. I think it will be useful to help your community upgrade to a safe version that removes the unencrypted git protocol without breaking/changing the public stable API exposed in version 4.3.1. The issue is caused by the reslter
|
We also experienced what is reported here. The issue was introduced after |
ended up just writing my own SendWithUs client in all of about 5 mins. Here's the code if it's helpful for anyone else (uses Axios for HTTP client): import axios from 'axios'
import SendWithUsApiError from '../errors/apiError'
import { SendWithUsSendEmailArgs } from '../types'
const BASE_URL = 'https://api.sendwithus.com/api/v1'
function handleError(error: any): SendWithUsApiError {
let message = ''
console.log('SENDWITHUS ERROR', error)
if (error.response && error.response.data) {
if (error.response.data.error) {
message = error.response.data.error
} else if (error.response.data.errors && error.response.data.errors.length) {
message = JSON.stringify(error.response.data.errors)
}
}
return new SendWithUsApiError(message)
}
const axiosInstance = axios.create({
baseURL: BASE_URL,
})
class SendWithUsApiClient {
async sendEmail(emailData: SendWithUsSendEmailArgs) {
let result
const apiKey = emailData.apiKey
try {
result = await axiosInstance({
method: 'post',
url: '/send',
headers: {
accept: 'application/json',
},
auth: {
username: apiKey,
password: '',
},
data: emailData,
})
} catch (error) {
throw handleError(error)
}
return result.data
}
}
export default new SendWithUsApiClient() types: export type SendwithUsFile = {
id: string
data: Buffer
}
export type SendWithUsSendEmailArgs = {
apiKey: string
template: string
template_data?: object
recipient: {
address: string
name?: string
}
sender: {
address: string
name?: string
reply_to?: string
}
files?: Array<SendwithUsFile>
} |
calling
Sendwithus.send
is failing every time -- had to downgrade to 4.3.1Client version
4.3.3
Expected behaviour
email to send
Actual behaviour
Steps to reproduce
call Sendwithus.send()
The text was updated successfully, but these errors were encountered: