A super helpful debugging tool for me has been in dispatcher.js, you can change line 3 from
var request = require('request');
to
var request = require('request');
request.debug = true;
And that will show you the actual request you’re making, which is extremely helpful for debugging. There may be a way to enable debugging without editing library files, but I’m unaware of it.
Anyway, I’m able to create an attachment with this:
@anon89411875, you should try to recreate the request in postman, insomnia, or curl and see if you still get this issue to confirm it’s an issue with our API. Just based off that error I don’t have much insight.
The error might be due to attachment size. I believe our limit is currently 25MB.
I tested the attachment endpoint in postman and there it works. Using the same file and the code you suggested, I could not successfully send the request on my local nodeJS server.
I found the problem. I am using OAuth authentication. But the file-upload only works when I’m authenticated over a personal-access-token. Is this a intended behaviour?
It works in Postman. It is a problem with the asana npm package. I copied the same options from the request debug output and made that same call using the pure request npm package. There it works. I tried it now a few times and the only requests failing are these using the asana npm package