TypeError: The "iterable" argument must be an instance of Iterable. Received an instance of Object
Hello team, I've the following configuration on Typescript:
const eannaContainer = await new GenericContainer(
'<server name>/eanna/release:4.3.0')
.withNetwork(network)
.withNetworkAliases('eannahost')
.withExposedPorts({
container: 8080,
host: 6080
})
.withCopyFilesToContainer(
[{source: rootE2gFolderPath + '/config/eanna/logback-spring.xml', target: '/deployments/config/logback-spring.xml'}])
.withEnvironment({
...eannaEnv,
JAVA_MAX_MEM_RATIO: '100',
JAVA_INIT_MEM_RATIO: '50'
})
.withStartupTimeout(300000) // wait 5 min
.withWaitStrategy(Wait.forHttp('/actuator/health', 8080))
.start();
But when I trigger it with our CI/CD pipeline, i get the following exception:
[21:33:27.404+02:00] - TypeError: The "iterable" argument must be an instance of Iterable. Received an instance of Object
[21:33:27.404+02:00] - at from (node:internal/streams/from:36:11)
[21:33:27.404+02:00] - at Function.Readable.from (node:internal/streams/readable:1729:10)
[21:33:27.404+02:00] - at DockerContainerClient.putArchive (/home/jenkins/agent/workspace/edossier2go-edossier/edossier2go-edossier-develop/build-deploy-test/angular-frontend/node_modules/.pnpm/[email protected]/node_modules/testcontainers/src/container-runtime/clients/container/docker-container-client.ts:78:37)
[21:33:27.404+02:00] - at processTicksAndRejections (node:internal/process/task_queues:105:5)
This bug has been introduced after the version 10.21.0 (it works for this version).
After analysis, the problem comes from the setup of the file to copy: withCopyFilesToContainer On my environment I've defined the following configuration:
.withCopyFilesToContainer(
[{source: rootE2gFolderPath + '/config/eanna/logback-spring.xml', target: '/deployments/config/logback-spring.xml'}])
Could you please double check in the code this piece of code:
if (this.filesToCopy.length > 0 || this.directoriesToCopy.length > 0 || this.contentsToCopy.length > 0) {
const archive = this.createArchiveToCopyToContainer();
archive.finalize();
await client.container.putArchive(container, archive, "/");
}
Thanks a lot Luc
This code hasn't changed in two years:
https://github.com/testcontainers/testcontainers-node/blob/b31eaca1fd9d2599f0cd30e94b182ec0b765fff1/packages/testcontainers/src/generic-container/generic-container.ts#L181-L185
However, the dockerode dependency (client.container.putArchive) was upgraded from v3 to v4 in the 10.22.0 release.
What version of NodeJS are you using?
Cannot reproduce. If it's still an issue please provide node/docker versions as per the issue template and I'll reopen.