File upload 500 Server Error

I am calling the monday api from an AWS lambda function using the node axios client. I am getting 500 responses from monday servers when uploading PDF files to an item.

Request Info:

2020-12-30T06:34:39.597Z	8dab0df3-9f83-4ed2-8a0c-d4353f9f2bbc	INFO	{ AcceptRanges: 'bytes',  LastModified: 2020-12-30T06:34:36.000Z,  ContentLength: 409600,  ETag: '"16a3e0cfa739c02f46713efb57edab2d"',  ContentType: 'application/pdf',  Metadata: {},  Body:   <Buffer 25 50 44 46 2d 31 2e 35 0a 25 d0 d4 c5 d8 0a 34 20 30 20 6f 62 6a 0a 3c 3c 0a 2f 54 79 70 65 20 2f 58 4f 62 6a 65 63 74 0a 2f 53 75 62 74 79 70 65 20 ... > }

2020-12-30T06:34:39.978Z	8dab0df3-9f83-4ed2-8a0c-d4353f9f2bbc	INFO	{ url: 'https://api.monday.com/v2/file',  method: 'post',  data:   FormData {     _overheadLength: 287,     _valueLength: 409719,     _valuesToMeasure: [],     writable: false,     readable: true,     dataSize: 0,     maxDataSize: 2097152,     pauseStreams: true,     _released: true,     _streams: [],     _currentStream: null,     _insideLoop: false,     _pendingNext: false,     _boundary: '--------------------------007355632934804322566963',     _events:      [Object: null prototype] { error: [Function: handleStreamError] },     _eventsCount: 1 },  headers:   { Accept: 'application/pdf',     'Content-Type':      'multipart/form-data; boundary=--------------------------007355632934804322566963',     Authorization:      'REDACTED',     'User-Agent': 'axios/0.21.0' },  transformRequest: [ [Function: transformRequest] ],  transformResponse: [ [Function: transformResponse] ],  timeout: 0,  adapter: [Function: httpAdapter],  xsrfCookieName: 'XSRF-TOKEN',  xsrfHeaderName: 'X-XSRF-TOKEN',  maxContentLength: -1,  maxBodyLength: -1,  validateStatus: [Function: validateStatus] }

Response Info:

2020-12-30T06:34:39.957Z 8dab0df3-9f83-4ed2-8a0c-d4353f9f2bbc INFO { error_message: ‘Internal server error’, status_code: 500 }

2020-12-30T06:34:39.957Z 8dab0df3-9f83-4ed2-8a0c-d4353f9f2bbc INFO { date: ‘Wed, 30 Dec 2020 06:34:39 GMT’, ‘content-type’: ‘application/json; charset=utf-8’, ‘transfer-encoding’: ‘chunked’, connection: ‘close’, ‘set-cookie’: [ ‘__cfduid=ddcb94f19de4d6e3da7cf587a083c52091609310079; expires=Fri, 29-Jan-21 06:34:39 GMT; path=/; domain=.monday.com; HttpOnly; SameSite=Lax; Secure’ ], ‘cache-control’: ‘no-cache’, ‘x-request-id’: ‘14094649-377c-90be-9d27-20cd64c53ce0’, ‘x-runtime’: ‘0.136303’, ‘x-envoy-upstream-service-time’: ‘138’, ‘content-security-policy’: ‘removed.because.this.forum.limits.number.of.links.com; worker-src ‘self’ ‘unsafe-inline’ blob:’, ‘x-xss-protection’: ‘1; mode=block’, vary: ‘Accept-Encoding’, ‘x-monday-rgn’: ‘use1’, ‘cf-cache-status’: ‘DYNAMIC’, ‘cf-request-id’: ‘0753f422fa0000ea30743ec000000001’, ‘expect-ct’: ‘max-age=604800, report-uri=“https://report-uri.cloudflare.com/cdn-cgi/beacon/expect-ct”’, ‘strict-transport-security’: ‘max-age=15552000; includeSubDomains; preload’, server: ‘cloudflare’, ‘cf-ray’: ‘6099bc7e5d54ea30-IAD’ }

My lambda code looks like:

function uploadReportToMonday(buffer, mondaySyncRecord, exhibitRecord){
const form = new FormData();
// Second argument can take Buffer or Stream (lazily read during the request) too.
// Third argument is filename if you want to simulate a file upload. Otherwise omit.

const query = `mutation ($file: File!) { add_file_to_column (file: $file, item_id: ${mondaySyncRecord.itemId}, column_id: "${mondaySyncRecord.columnId}") { id } }`;
form.append(‘variables[file]’, buffer, exhibitRecord.filename);
form.append(‘query’, query);
const headers = form.getHeaders();
headers[‘Authorization’] = mondaySyncRecord.token;
headers[‘Accept’] = ‘application/pdf’;
return axios.create({
headers
})
.post(‘https://api.monday.com/v2/file’, form);
}

Any Suggestions?

I don’t seem to have any issues DOWNLOADING files from the monday api in my lambda environment, only UPLOADING.

It turns out that this ended up being an item_id mapping issue on our side. The Monday 500 error response information could be much more helpful!

Hi there,

Thank you for sharing your feedback!

I agree that our 500 server response doesn’t provide much info. In full transparency, I think that it might be better to rely on testing within your own code bring up any error messages.

However, I would be more than happy to forward your feedback to our Product team so that they may take this into consideration for future iterations of our product.

-Helen

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.