Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

[BUG]Unexpected end of JSON input #102

Open
LilianaRTSf opened this issue Jul 5, 2024 · 10 comments
Open

[BUG]Unexpected end of JSON input #102

LilianaRTSf opened this issue Jul 5, 2024 · 10 comments

Comments

@LilianaRTSf
Copy link

Hi, I am getting a JSON error every time i run the code analyzer in VS code: " Unexpected end of JSON input", in all my salesforce projects

image

@LilianaRTSf LilianaRTSf changed the title [BUG] [BUG]Unexpected end of JSON input Jul 5, 2024
@jfeingold35
Copy link
Collaborator

@LilianaRTSf , which command are you using, and what's the code you're running it against?

@jfeingold35
Copy link
Collaborator

@LilianaRTSf , also, do you have a valid sfdx-project.json file in the root of your project?

@LilianaRTSf
Copy link
Author

Hello, I am using the sfdx menu, I select a class and click "SFDX: Scan selected files or folders with code analyzer" I also tried the "SFDX:Scan current file with code analyzer", I have a sfdx-project.json, I can connect to my org and retrieve-deploy

@jfeingold35
Copy link
Collaborator

@LilianaRTSf , can you post the file that you're trying to scan? We're struggling to reproduce this on our end. Also, can you please indicate the following:

  • What version the Code Analyzer are you running (run sfdx plugins in the CLI and tell us what version it says for @salesforce/sfdx-scanner)
  • What OS are you using?

@LilianaRTSf
Copy link
Author

I am using v4.2.0, MacOs Sonoma 14.5

@jfeingold35
Copy link
Collaborator

@LilianaRTSf , could you also please post the file you're trying to scan? We can't reproduce it locally, so it's possible it's something to do with your file.

@stephen-carter-at-sf
Copy link
Collaborator

stephen-carter-at-sf commented Jul 9, 2024

@LilianaRTSf With VS Code open, can you please click on Help > "Toggle Developer Tools" which should reveal what looks like a chrome developer console window.

Then please do your repro steps and see what error messages appear in the console. Then paste those full error messages here please.

Additionally, have you tried to reproduce the issue with our CLI, specifically the sf scanner run command?

@LilianaRTSf
Copy link
Author

LilianaRTSf commented Jul 9, 2024

Hi, thank you all for your help, yesterday someone from my work helped me and I installed code analyzer via command line, also installed node and npm, to install a missing file called RetireJS, which was causing the error. Running Code Analyzer with the command line works fine (sf scanner run --normalize-severity --target force-app/main/default/classes/class.cls --outfile results2.html), but when I use the menu "SFDX: Scan selected files or folders with code analyzer" i get the error "[error] RetireJS: env: node: No such file or directory" but i already installed it
image

@jfeingold35
Copy link
Collaborator

@LilianaRTSf , stupid question, but did you restart VSCode after you installed all of these things?

@stephen-carter-at-sf
Copy link
Collaborator

@LilianaRTSf We are unable to reproduce on our end. Is this still an issue with you after installing the latest CLI and VS Code Extension?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants