Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

stop working for me (Solved) #135

Open
ozkrgonzalez opened this issue Jan 21, 2025 · 5 comments
Open

stop working for me (Solved) #135

ozkrgonzalez opened this issue Jan 21, 2025 · 5 comments

Comments

@ozkrgonzalez
Copy link

ozkrgonzalez commented Jan 21, 2025

i use this extension a lot, but i don't know when stop working, i tried go back to an older version but no luck, when i go to features, runtime status, i got this error:

Runtime Status
Activation
Activated by onCommand:sfdxPackageGen.chooseMetadata event: 0ms

Uncaught Errors (3)
Unexpected token '�', "�[97m{�[39"... is not valid JSON

Unexpected token '�', "�[97m{�[39"... is not valid JSON

Unexpected token '�', "�[97m{�[39"... is not valid JSON

i don't know if it's a file in my workspace or what is that json, is there any log to see?

EDIT: after see the logs, the problem is that at least y my enviroment, the command sf org display --json, returns the json with colors, so the unknow chars:

�[97m → bright white
�[94m → clear blue
�[92m → clear geen
�[32m → creen
�[39m → other color,

so the function getAPIVersion doesn't know what to do

@ozkrgonzalez
Copy link
Author

ozkrgonzalez commented Jan 21, 2025

i follow the instructions from other issue to get de develoepr console logs, after replaceing some confidential info, here is the log

`console.ts:137 [Extension Host]% {}
console.ts:137 [Extension Host] getAPIVersion invoked
console.ts:137 [Extension Host] stdout: {
"status": 0,
"result": {
"id": "SOMEID",
"apiVersion": "63.0",
"accessToken": "SOME.Access.TOKEN",
"instanceUrl": "https://someORG.sandbox.my.salesforce.com",
"username": "myUserName@someOrg.mySandbox.com",
"clientId": "PlatformCLI",
"connectedStatus": "Connected",
"alias": "MySandBox"
},
"warnings": [
"This command will expose sensitive information that allows for subsequent activity using your current authenticated session.\nSharing this information is equivalent to logging someone in under the current credential, resulting in unintended access and escalation of privilege.\nFor additional information, please review the authorization section of the https://developer.salesforce.com/docs/atlas.en-us.sfdx_dev.meta/sfdx_dev/sfdx_dev_auth_web_flow.htm."
]
}

console.ts:137 [Extension Host] exited with code 0
console.ts:137 [Extension Host] bufferOutData {
"status": 0,
"result": {
"id": "SOMEID",
"apiVersion": "63.0",
"accessToken": "SOME.Access.TOKEN",
"instanceUrl": "https://someORG.sandbox.my.salesforce.com",
"username": "myUserName@someOrg.mySandbox.com",
"clientId": "PlatformCLI",
"connectedStatus": "Connected",
"alias": "MySandBox"
},
"warnings": [
"This command will expose sensitive information that allows for subsequent activity using your current authenticated session.\nSharing this information is equivalent to logging someone in under the current credential, resulting in unintended access and escalation of privilege.\nFor additional information, please review the authorization section of the https://developer.salesforce.com/docs/atlas.en-us.sfdx_dev.meta/sfdx_dev/sfdx_dev_auth_web_flow.htm."
]
}

mainThreadExtensionService.ts:78 [VignaeshRamA.sfdx-package-xml-generator]Unexpected token '�', "{�[39"... is not valid JSON
$onExtensionRuntimeError @ mainThreadExtensionService.ts:78
S @ rpcProtocol.ts:458
Q @ rpcProtocol.ts:443
M @ rpcProtocol.ts:373
L @ rpcProtocol.ts:299
(anonymous) @ rpcProtocol.ts:161
B @ event.ts:1243
fire @ event.ts:1274
fire @ ipc.net.ts:652
l.onmessage @ localProcessExtensionHost.ts:378
mainThreadExtensionService.ts:79 SyntaxError: Unexpected token '�', "{�[39"... is not valid JSON at JSON.parse () at ChildProcess. (c:\Users\donka.vscode\extensions\vignaeshrama.sfdx-package-xml-generator-2.1.0\out\extension.js:82:29) at ChildProcess.emit (node:events:518:28) at ChildProcess._handle.onexit (node:internal/child_process:293:12)
$onExtensionRuntimeError @ mainThreadExtensionService.ts:79
S @ rpcProtocol.ts:458
Q @ rpcProtocol.ts:443
M @ rpcProtocol.ts:373
L @ rpcProtocol.ts:299
(anonymous) @ rpcProtocol.ts:161
B @ event.ts:1243
fire @ event.ts:1274
fire @ ipc.net.ts:652
l.onmessage @ localProcessExtensionHost.ts:378
`

@ozkrgonzalez
Copy link
Author

after update: extension.js

i set const envVars = Object.assign({}, process.env, { FORCE_COLOR: "0" }); at the beginning of the script, then in every child.exec i set ent env: envVars, there are 6 places where to add this line, and now the extension is working fine:

here an example of the replacement:

    const foo = child.exec(sfdxCmd, {
        maxBuffer: 1024 * 1024 * 10,  // Incremento de buffer a 10MB
        cwd: workspacePath,
		env: envVars
    });

@ozkrgonzalez ozkrgonzalez changed the title stop working for me stop working for me (Solved) Jan 21, 2025
@vignaesh01
Copy link
Owner

vignaesh01 commented Jan 22, 2025 via email

@ozkrgonzalez
Copy link
Author

Hi, are you using Mac?
Thanks,
Vignaesh Ram A

no, windows 11

@benji1304
Copy link

I'm still getting this error, nearly daily. Usually restarting VS Code resolves it but it's not consitent.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants