Skip to content

accountCopyIndex has unhandled promise rejection #1153

@julienpa

Description

@julienpa

Using v4.2.0 of the JS API Client

Here is my full code:

const algoliasearch = require('algoliasearch')
const accountCopyIndex = require('@algolia/client-account').accountCopyIndex

const srcAppId = 'F6ZK2OJ8P7'
const dstAppId = 'RSBCBF0EG8'
const srcApiKey = 'ask_me_for_the_key' // browse + settings
const dstApiKey = 'ask_me_for_the_key' // addObject + editSettings + settings
const srcClient = algoliasearch(srcAppId, srcApiKey)
const dstClient = algoliasearch(dstAppId, dstApiKey)

const src = srcClient.initIndex('TPT_Resources')
const dst = dstClient.initIndex('TPT_Resources_copy')
console.log('Copying', src.indexName, '→', dst.indexName)
accountCopyIndex(src, dst)
  .then(() => console.log('Done'))
  .catch(e => console.log(e))

And here is what I get when I run this code:

Copying TPT_Resources → TPT_Resources_copy
(node:25405) UnhandledPromiseRejectionWarning: #<Object>
(Use `node --trace-warnings ...` to show where the warning was created)
(node:25405) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
(node:25405) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

Tried with different apps and indices of different sizes (several millions, or a few hundred thousand records), and the result is the same. It did work for very small indices like 1-2k records.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions