The Movie Database Support

Hi , I'm gettting this error 5/10 times I make an api call from my app....can someone please guide me...where am i going wrong?? Im stuck on this error...since past 2 days....it works sometimes...and other times it shows the following error.....i have updated node version as well...and my internet connection is pretty stable... this is my code snippet-

try {
    var id = await axios({
      method: "get",
      url: `https://api.themoviedb.org/3/search/movie?api_key=keyc&language=en-US&page=1&include_adult=false&query=${searchTerm}`,
    });
    var id2 = id.data.results[0].id;

    var response = await axios({
      url: `https://api.themoviedb.org/3/movie/${id2}/recommendations?api_key=key&append_to_response=videos&language=en-US&page=1`,
      method: "GET",
    });
    var finalresult = response.data.results;

    const getlink = [];
      for(let i=0;i<finalresult.length;i++){
       const getvideourl =  await axios({
        url: `https://api.themoviedb.org/3/movie/${finalresult[i].id}/videos?api_key=key`,
        method: "GET",
      });
      getlink.push(getvideourl.data.results[0].key);

    }
  } catch (error) {
    console.error(error);
  }

this is the error i receive almost 6 out of 10 times... i make an api call

Error: read ECONNRESET
    at TLSWrap.onStreamRead (internal/stream_base_commons.js:209:20) {    
  errno: -4077,
  code: 'ECONNRESET',
  syscall: 'read',
  config: {
    url: 'https://api.themoviedb.org/3/search/movie?api_key=apikey&language=en-US&page=1&include_adult=false&query=harry potter',
    method: 'get',
    headers: {
      Accept: 'application/json, text/plain, */*',
      'User-Agent': 'axios/0.21.1'
    },
    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],
    data: undefined
  },
  request: <ref *1> Writable {
    _writableState: WritableState {
      objectMode: false,
      highWaterMark: 16384,
      finalCalled: false,
      needDrain: false,
      ending: false,
      ended: false,
      finished: false,
      destroyed: false,
      decodeStrings: true,
      defaultEncoding: 'utf8',
      length: 0,
      writing: false,
      corked: 0,
      sync: true,
      bufferProcessing: false,
      onwrite: [Function: bound onwrite],
      writecb: null,
      writelen: 0,
      afterWriteTickInfo: null,
      buffered: [],
      bufferedIndex: 0,
      allBuffers: true,
      allNoop: true,
      pendingcb: 0,
      prefinished: false,
      errorEmitted: false,
      emitClose: true,
      autoDestroy: true,
      errored: null,
      closed: false
    },
    _events: [Object: null prototype] {
      response: [Function: handleResponse],
      error: [Function: handleRequestError]
    },
    _eventsCount: 2,
    _maxListeners: undefined,
    _options: {
      maxRedirects: 21,
      maxBodyLength: 10485760,
      protocol: 'https:',
      path: '/3/search/movie?api_key=apikey&language=en-US&page=1&include_adult=false&query=harry%20potter',
      method: 'GET',
      headers: [Object],
      agent: undefined,
      agents: [Object],
      auth: undefined,
      hostname: 'api.themoviedb.org',
      port: null,
      nativeProtocols: [Object],
      pathname: '/3/search/movie',
      search: '?api_key=apikey&language=en-US&page=1&include_adult=false&query=harry%20potter'
    },
    _ended: true,
    _ending: true,
    _redirectCount: 0,
    _redirects: [],
    _requestBodyLength: 0,
    _requestBodyBuffers: [],
    _onNativeResponse: [Function (anonymous)],
    _currentRequest: ClientRequest {
      _events: [Object: null prototype],
      _eventsCount: 7,
      _maxListeners: undefined,
      outputData: [],
      outputSize: 0,
      writable: true,
      destroyed: false,
      _last: true,
      chunkedEncoding: false,
      shouldKeepAlive: false,
      _defaultKeepAlive: true,
      useChunkedEncodingByDefault: false,
      sendDate: false,
      _removedConnection: false,
      _removedContLen: false,
      _removedTE: false,
      _contentLength: 0,
      _hasBody: true,
      _trailer: '',
      finished: true,
      _headerSent: true,
      socket: [TLSSocket],
      _header: 'GET /3/search/movie?api_key=apikey&language=en-US&page=1&include_adult=false&query=harry%20potter HTTP/1.1\r\n' +
        'Accept: application/json, text/plain, */*\r\n' +
        'User-Agent: axios/0.21.1\r\n' +
        'Host: api.themoviedb.org\r\n' +
        'Connection: close\r\n' +
        '\r\n',
      _keepAliveTimeout: 0,
      _onPendingData: [Function: noopPendingOutput],
      agent: [Agent],
      socketPath: undefined,
      method: 'GET',
      maxHeaderSize: undefined,
      insecureHTTPParser: undefined,
      path: '/3/search/movie?api_key=apikey&language=en-US&page=1&include_adult=false&query=harry%20potter',
      _ended: false,
      res: null,
      aborted: false,
      timeoutCb: null,
      upgradeOrConnect: false,
      parser: null,
      maxHeadersCount: null,
      reusedSocket: false,
      host: 'api.themoviedb.org',
      protocol: 'https:',
      _redirectable: [Circular *1],
      [Symbol(kCapture)]: false,
      [Symbol(kNeedDrain)]: false,
      [Symbol(corked)]: 0,
      [Symbol(kOutHeaders)]: [Object: null prototype]
    },
    _currentUrl: 'https://api.themoviedb.org/3/search/movie?api_key=apikey&language=en-US&page=1&include_adult=false&query=harry%20potter',
    [Symbol(kCapture)]: false
  },
  response: undefined,
  isAxiosError: true,
  toJSON: [Function: toJSON]
}

3 replies (on page 1 of 1)

Jump to last post

Hey I have been getting the same error. Found any fix?
EDIT: nvm, it is an issue on my network/PC.

How did you solve this Issue

It is the problem from the ISPs. In India, most ISPs have blocked the tmdb ips for some reason, it somehow works sometims but most of the times it will throw you an error. Using a VPN(not Indian IP) will get you out of the error. All you can do now is restart your server again and again until the error is gone(until it appears again) or complaint to your ISP and try to get them unblock the tmdb sites

Can't find a movie or TV show? Login to create it.

Want to rate or add this item to a list?

Login