title: How Do I Resolve this 'Too Many Requests' Error in Node.js?
body: <p>I'm trying to build a <code>JSON</code> file by making successive <code>HTTP requests</code> with <code>Axios</code>:  </p>
  
  <ol>
  <li>Get an array of objects (projects)</li>
  <li>Create an array property in each project named attachments</li>
  <li>Get each project's tasks</li>
  <li>Get each task's attachments</li>
  <li>Push each project's task's attachments in to the project's attachments array</li>
  <li>Create a <code>JSON</code> file out of the modified projects array</li>
  </ol>
  
  <p><strong>Code:</strong></p>
  
  <pre><code>let getProjects = function() {
    try {
      return axios.get('https://app.asana.com/api/1.0/projects/')
    } catch (error) {
      console.error(error)
    }
  }
  
  let getTasks = function(project) {
    try {
      return axios.get('https://app.asana.com/api/1.0/projects/'+project+'/tasks')
    } catch (error) {
      console.error(error)
    }
  }
  
  let getAttachments = function(task) {
    try {
      return axios.get('https://app.asana.com/api/1.0/tasks/'+task+'/attachments')
    } catch (error) {
      console.error(error)
    }
  }
  
  async function getAsanaData() {
    let projects = await getProjects()
    return Promise.all(projects.data.data.map(async (project) =&gt; {
        project.attachments = []
        let tasks = await getTasks(project.gid)
        return Promise.all(tasks.data.data.map(async (task) =&gt; {
          let attachments = await getAttachments(task.gid)
          project.attachments = !!attachments ? project.attachments.concat(attachments.data.data) : project.attachments 
          return project
        }))
    }))
  }
  
  getAsanaData()
  .then((projects) =&gt; {  
    var asanaData = safeJsonStringify(projects);
    fs.writeFile("thing.json", asanaData);
  })
  .catch(err=&gt;console.log(err))
  </code></pre>
  
  <p>But I'm running into this error:</p>
  
  <pre><code>status: 429,
  statusText: 'Too Many Requests
  </code></pre>
  
  <p>I haven't found anything helpful yet for figuring out how to resolve it.  What can I do?</p>