Cli: Unable to push deleted Report due to unescaped separator '\'

Created on 3 Jul 2019  路  10Comments  路  Source: forcedotcom/cli

Summary

I am currently unable to push to scratch org if a report name start with letter D.

Steps To Reproduce:

  1. Create a report in public folder nammed "Demo"
  2. pull sources
  3. delete said report
  4. modify anuthng else in sfdx project
  5. Push

Expected result

Everything gets pushed

Actual result

Following error related to char escaping :

ERROR running force:source:push: 
SourceMember WHERE MemberName IN ('unfiled$public\Demo_time_per_lead_1Yb'
                                 ^
ERROR at Row:1:Column:85
Invalid string literal 'unfiled$public\Demo_time_per_lead_1Yb'. Illegal character sequence '\D' in string literal. 

Additional information

SFDX CLI Version(to find the version of the CLI engine run sfdx --version):
sfdx-cli/7.11.2-4a5bf6aa97 win32-x64 node-v10.15.3

SFDX plugin Version(to find the version of the CLI plugin run sfdx plugins --core):
@oclif/plugin-commands 1.2.2 (core)
@oclif/plugin-help 2.2.0 (core)
@oclif/plugin-not-found 1.2.2 (core)
@oclif/plugin-plugins 1.7.8 (core)
@oclif/plugin-update 1.3.9 (core)
@oclif/plugin-warn-if-update-available 1.7.0 (core)
@oclif/plugin-which 1.0.3 (core)
@salesforce/sfdx-trust 3.0.5 (core)
analytics 1.1.2 (core)
generator 1.1.0 (core)
salesforcedx 46.1.5 (core)
鈹溾攢 force-language-services 46.3.0 (core)
鈹斺攢 salesforce-alm 46.3.0 (core)

sfdx-cli 7.11.2 (core)

OS and version:
Win10

bug

Most helpful comment

@Gruck Thank you for pointing this out. I am putting it on our backlog now.

All 10 comments

I have the same issue with \C:

ERROR running force:source:push:  
SourceMember WHERE MemberName IN ('SupervisorReports\Closed_Case_Report1')
                                 ^
ERROR at Row:1:Column:85
Invalid string literal 'SupervisorReports\Closed_Case_Report1'. Illegal character sequence '\C' in string literal.

Same issue, I moved Report from Public Folder to New Custom Folder.
image

OK, so basically un unescapped \ ruins everything.

Found the bug. Actually, this string is being parsed as a query inside Salesforce, as we can see by the output.
What I did, as a temp fix (version 7.30.12-9919bf456f), was editing the "sourceConvertApi.js" file, in the sfdx main installation folder (sfdx\client\7.30.12-9919bf456f\node_modules\salesforce-almdist\lib\source\sourceConvertApi.js).

Line 31:
const singleQuoteJoin = arr => arr.map(val => `'${val}'`).join();

Edited into:
const singleQuoteJoin = arr => arr.map(val => `'${val.replace('\\', '\\\\')}'`).join();

Basically, just escaped the backslash.

@Gruck Thank you for pointing this out. I am putting it on our backlog now.

I have tried that fix, and I hasn't fixed anything. I have somehow ended up with duplicate report details in my source and deleting one, deleting a folder or renaming the report file name all result in this error and I'm now stuck. I did close VS Code and re-open it after making the change. I'm also on Windows 10.

Aha! The work around by @jamesmelville on #165 actually works!

Workaround: manually delete entries from sourcePathInfos.json, and manually delete from org, pull & push.

I'm seeing likely this same bug, but then on a Document metadata type:

PS C:\Users\maria\Documents\DX\hr2day-dx> sfdx force:source:push
ERROR running force:source:push: 
SourceMember WHERE MemberName IN ('employer_logo\a0P8A000001gM8lUAE_202002204000025')
                                 ^
ERROR at Row:1:Column:85
Invalid string literal 'employer_logo\a0P8A000001gM8lUAE_202002204000025'. Illegal character sequence '\a' in string literal.

The workaround that @JodieM suggested worked in this instance too.

Can you provide an estimate when a bugfix will find its way to a release?

@clairebianchi do you have an update?

@OscarScholten I have this on our backlog for the summer release.

Was this page helpful?
0 / 5 - 0 ratings