Receiving error when trying to use source code scan API - Sonatype Lifecycle & Repository Firewall - Sonatype Community

Receiving error when trying to use source code scan API

post by david.mcdonough on Dec 27, 2022

David McDonough
Sonatype Customer

Hello, my org just installed nexusiq, so we’re really still getting. Some of our apps haven’t been built since we installed nexusiq, so only a handful currently have reports.

I was trying to use this info to perform a scan on an app, and I’m getting an error that I’ve had no luck googling. This is my current code and the output:

$appid = '#################'
$baseURL = 'https://nexusiq.myorg.com'

$credParam = @{  
    Credential     = $myCred  
    Authentication = 'Basic'  
}

$scanParam = @{  
    ContentType = 'application/json'  
    Method      = 'Post'  
    body        = @{  
        stageId    = 'develop'  
        branchName = 'master'  
    } | ConvertTo-Json -Depth 4  
}
Invoke-RestMethod @credParam -Uri "$baseURL/api/v2/evaluation/applications/$appid/sourceControlEvaluation" @scanParam -OutVariable status

Invoke-RestMethod @credParam -Uri "$baseURL/$($status[0].statusUrl)"

When I check the status of the call I see this result:

status reason


FAILED Internal Server Error (ID ed4f19d9c6ab4b9f)

Is that error ID a generic error code, or an ID need to track down in some other log source?

Alternately, is there a way to kick off a source code scan from within the webui?


post by amaster on Jan 9, 2023

Amit Master
Sonatypers

Hi David, I see you posted this response 13 days ago. My apologies for the late response. The Internal Server Error is vague and does not really indicate where the issue lies. You can attempt to duplicate the error again and then check the log directory in a file named clm-server.log. If you search on the ID, this should provide you with more details.

Some things to check are if the credentials are correct, does the Application ID exist in the application, is the URL correct, etc.

Alternately, depending on the type of source code you have, you can scan this as a binary in your WebUI by doing the following:

This will scan in your source code. Once completed, you can navigate to the “Reports” section on the left-hand side and find the generated report.