Skip to content

Bug report: spo file copy sometimes failing #6422

@milanholemans

Description

@milanholemans

Priority

(Medium) I'm annoyed but I'll live

Description

I'm currently migrating a lot of SharePoint pages to another site collection. While 95% of the files are working great, I noticed that about 5% (or less) of the files are failing with a vague error:

Error: Cannot read properties of undefined (reading 'TargetObjectSiteRelativeUrl')

This error is caused by this piece of code:

const copyJobResult = await spo.getCopyJobResult(args.options.webUrl, copyJobResponse);
if (this.verbose) {
await logger.logToStderr('Getting information about the destination file...');
}
// Get destination file data
const siteRelativeDestinationFolder = '/' + copyJobResult.TargetObjectSiteRelativeUrl.substring(0, copyJobResult.TargetObjectSiteRelativeUrl.lastIndexOf('/'));
const absoluteWebUrl = destinationPath.substring(0, destinationPath.toLowerCase().lastIndexOf(siteRelativeDestinationFolder.toLowerCase()));

I noticed that sometimes, for some files, the SharePoint copy job doesn't return a result object. I currently have no idea why/when this is happening. When this error occurs on a file and I try again, everything works just fine.

Steps to reproduce

Migrate a lot of files. It's hard to reproduce.

Expected results

100% success rate

Actual results

2-5% of the files throw an error:

Error: Cannot read properties of undefined (reading 'TargetObjectSiteRelativeUrl')

Diagnostics

No response

CLI for Microsoft 365 version

v10.0.0

nodejs version

v20.10.0

Operating system (environment)

Windows

Shell

PowerShell

cli doctor

No response

Additional Info

Let's put it on hold until the following issues are closed:

These issues have a higher importance and need to change stuff to the SharePoint copy job util as well.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions