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

ERROR: 400 Bad Request on /api/developer-scans/xxx?offset=0&limit=100 #197

Open
zengshengliu opened this issue Feb 2, 2024 · 3 comments

Comments

@zengshengliu
Copy link

I am trying to switch from using the bash script of the BlackDuck Detect to this action and running into issue when it waits for the scan.

The following configuration is for the bash script which works fine

      - name: BlackDuck Detect
        run: |
          bash <(curl -s https://detect.synopsys.com/detect9.sh) \
            --blackduck.url=${{ secrets.BLACKDUCK_URL }} \
            --blackduck.api.token=${{ secrets.BLACKDUCK_API_KEY }} \
            --detect.project.name=${{ needs.get_blackduck_tag.outputs.name }} \
            --detect.blackduck.scan.mode=${{ needs.get_blackduck_tag.outputs.mode }} \
            --detect.project.version.name=${{ needs.get_blackduck_tag.outputs.version }} \
            --detect.project.version.phase=${{ needs.get_blackduck_tag.outputs.phase }} \
            --detect.project.version.distribution=INTERNAL \
            --detect.project.version.update=true

But when I try to use the action with the following configuration

      - name: Black Duck Scan
        uses: synopsys-sig/synopsys-action@v1.6.0
        env:
          DETECT_BLACKDUCK_SCAN_MODE: ${{ needs.get_blackduck_tag.outputs.mode }}
          DETECT_PROJECT_NAME: ${{ needs.get_blackduck_tag.outputs.name }}
          DETECT_PROJECT_VERSION_DISTRIBUTION: INTERNAL
          DETECT_PROJECT_VERSION_NAME: ${{ needs.get_blackduck_tag.outputs.version }}
          DETECT_PROJECT_VERSION_PHASE: ${{ needs.get_blackduck_tag.outputs.phase }}
          DETECT_PROJECT_VERSION_UPDATE: true
          LOGGING_LEVEL_DETECT: DEBUG
        with:
          blackduck_url: ${{ secrets.BLACKDUCK_URL }}
          blackduck_token: ${{ secrets.BLACKDUCK_API_KEY }}
          blackduck_prComment_enabled: true
          github_token: ${{ secrets.GITHUB_TOKEN }}

I got the 400 Bad Request in one of the step. I verified that the variables we set for the detect are the same across both run. The debug log is shown below

2024-02-02 01:48:02.0000 UTC [Blackduck Execution] [main] INFO: --- ----------------------------------
2024-02-02 01:48:02.0000 UTC [Blackduck Execution] [main] INFO: --- Project name: {repo}
2024-02-02 01:48:02.0000 UTC [Blackduck Execution] [main] INFO: --- Project version: 2024.02.01
2024-02-02 01:48:03.0000 UTC [Blackduck Execution] [main] INFO: --- Begin Rapid Mode Scan
2024-02-02 01:48:04.0000 UTC [Blackduck Execution] [main] INFO: --- Uploaded Rapid Scan: ***/api/developer-scans/d9934315-8823-4bc4-aa63-70b04b51eadd
[202](https://github.com/{org}/{repo}/actions/runs/7750219629/job/21136168242?pr=93#step:4:203)4-02-02 01:48:04.0000 UTC [Blackduck Execution] [main] INFO: --- ----------------------------------
2024-02-02 01:48:04.0000 UTC [Blackduck Execution] [main] INFO: --- Signature Scanner tool will not be run.
2024-02-02 01:48:04.0000 UTC [Blackduck Execution] [main] INFO: --- ----------------------------------
2024-02-02 01:48:04.0000 UTC [Blackduck Execution] [main] INFO: --- Binary Scanner tool will not be run.
2024-02-02 01:48:04.0000 UTC [Blackduck Execution] [main] INFO: --- ----------------------------------
2024-02-02 01:48:04.0000 UTC [Blackduck Execution] [main] INFO: --- Container Scanner tool will not be run.
2024-02-02 01:48:04.0000 UTC [Blackduck Execution] [main] INFO: --- Try #1 for task Waiting for Rapid Scans (elapsed: 00:00:00.000)...not done yet, waiting 1 seconds and trying again...
2024-02-02 01:48:05.0000 UTC [Blackduck Execution] [main] ERROR: --- ----------------------------------
2024-02-02 01:48:05.0000 UTC [Blackduck Execution] [main] ERROR: --- Detect run failed.
2024-02-02 01:48:05.0000 UTC [Blackduck Execution] [main] ERROR: --- An unrecoverable error occurred which may be due to your environment and/or configuration. Please double check the Detect documentation: https://sig-product-docs.synopsys.com/bundle/integrations-detect/page/introduction.html
2024-02-02 01:48:05.6168 UTC [Blackduck Execution] INFO: com.synopsys.integration.rest.exception.IntegrationRestException: There was a problem trying to GET ***/api/developer-scans/d9934315-8823-4bc4-aa63-70b04b51eadd?offset=0&limit=100, response was 400 Bad Request, reason phrase was Bad Request.
2024-02-02 01:48:05.6169 UTC [Blackduck Execution] INFO: 	at com.synopsys.integration.rest.response.DefaultResponse.throwExceptionForError(DefaultResponse.java:[210](https://github.com/{org}/{repo}/actions/runs/7750219629/job/21136168242?pr=93#step:4:211))
2024-02-02 01:48:05.6169 UTC [Blackduck Execution] INFO: 	at com.synopsys.integration.blackduck.http.client.DefaultBlackDuckHttpClient.throwExceptionForError(DefaultBlackDuckHttpClient.java:104)
2024-02-02 01:48:05.6169 UTC [Blackduck Execution] INFO: 	at com.synopsys.integration.blackduck.service.BlackDuckApiClient.execute(BlackDuckApiClient.java:166)
2024-02-02 01:48:05.6170 UTC [Blackduck Execution] INFO: 	at com.synopsys.integration.detect.workflow.blackduck.developer.blackduck.DetectRapidScanWaitJobFull.isComplete(DetectRapidScanWaitJobFull.java:60)
2024-02-02 01:48:05.6170 UTC [Blackduck Execution] INFO: 	at com.synopsys.integration.detect.workflow.blackduck.developer.blackduck.DetectRapidScanWaitJobFull.attemptJob(DetectRapidScanWaitJobFull.java:48)
2024-02-02 01:48:05.6170 UTC [Blackduck Execution] INFO: 	at com.synopsys.integration.wait.ResilientJobExecutor.executeJob(ResilientJobExecutor.java:34)
2024-02-02 01:48:05.6171 UTC [Blackduck Execution] INFO: 	at com.synopsys.integration.detect.workflow.blackduck.developer.RapidModeWaitOperation.waitForFullScans(RapidModeWaitOperation.java:36)
2024-02-02 01:48:05.6171 UTC [Blackduck Execution] INFO: 	at com.synopsys.integration.detect.lifecycle.run.operation.OperationRunner.lambda$waitForFullRapidResults$10(OperationRunner.java:570)
2024-02-02 01:48:05.6171 UTC [Blackduck Execution] INFO: 	at com.synopsys.integration.detect.lifecycle.run.step.utility.OperationWrapper.wrapped(OperationWrapper.java:36)
2024-02-02 01:48:05.6172 UTC [Blackduck Execution] INFO: 	at com.synopsys.integration.detect.lifecycle.run.step.utility.OperationWrapper.wrapped(OperationWrapper.java:27)
2024-02-02 01:48:05.6172 UTC [Blackduck Execution] INFO: 	at com.synopsys.integration.detect.lifecycle.run.step.utility.OperationAuditLog.namedInternal(OperationAuditLog.java:53)
2024-02-02 01:48:05.6172 UTC [Blackduck Execution] INFO: 	at com.synopsys.integration.detect.lifecycle.run.step.utility.OperationAuditLog.namedInternal(OperationAuditLog.java:48)
2024-02-02 01:48:05.6172 UTC [Blackduck Execution] INFO: 	at com.synopsys.integration.detect.lifecycle.run.operation.OperationRunner.waitForFullRapidResults(OperationRunner.java:567)
2024-02-02 01:48:05.6173 UTC [Blackduck Execution] INFO: 	at com.synopsys.integration.detect.lifecycle.run.step.RapidModeStepRunner.runOnline(RapidModeStepRunner.java:123)
2024-02-02 01:48:05.6173 UTC [Blackduck Execution] INFO: 	at com.synopsys.integration.detect.lifecycle.run.DetectRun.run(DetectRun.java:86)
2024-02-02 01:48:05.6173 UTC [Blackduck Execution] INFO: 	at com.synopsys.integration.detect.Application.runApplication(Application.java:[214](https://github.com/{org}/{repo}/actions/runs/7750219629/job/21136168242?pr=93#step:4:215))
2024-02-02 01:48:05.6173 UTC [Blackduck Execution] INFO: 	at com.synopsys.integration.detect.Application.run(Application.java:143)
2024-02-02 01:48:05.6174 UTC [Blackduck Execution] INFO: 	at org.springframework.boot.SpringApplication.callRunner(SpringApplication.java:759)
2024-02-02 01:48:05.6174 UTC [Blackduck Execution] INFO: 	at org.springframework.boot.SpringApplication.callRunners(SpringApplication.java:749)
2024-02-02 01:48:05.6174 UTC [Blackduck Execution] INFO: 	at org.springframework.boot.SpringApplication.run(SpringApplication.java:314)
2024-02-02 01:48:05.6175 UTC [Blackduck Execution] INFO: 	at org.springframework.boot.builder.SpringApplicationBuilder.run(SpringApplicationBuilder.java:164)
2024-02-02 01:48:05.6175 UTC [Blackduck Execution] INFO: 	at com.synopsys.integration.detect.Application.main(Application.java:97)
2024-02-02 01:48:05.6175 UTC [Blackduck Execution] INFO: 	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
2024-02-02 01:48:05.6175 UTC [Blackduck Execution] INFO: 	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
2024-02-02 01:48:05.6175 UTC [Blackduck Execution] INFO: 	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
2024-02-02 01:48:05.6176 UTC [Blackduck Execution] INFO: 	at java.base/java.lang.reflect.Method.invoke(Method.java:568)
2024-02-02 01:48:05.6176 UTC [Blackduck Execution] INFO: 	at org.springframework.boot.loader.MainMethodRunner.run(MainMethodRunner.java:49)
2024-02-02 01:48:05.6176 UTC [Blackduck Execution] INFO: 	at org.springframework.boot.loader.Launcher.launch(Launcher.java:108)
2024-02-02 01:48:05.6177 UTC [Blackduck Execution] INFO: 	at org.springframework.boot.loader.Launcher.launch(Launcher.java:58)
2024-02-02 01:48:05.6177 UTC [Blackduck Execution] INFO: 	at org.springframework.boot.loader.JarLauncher.main(JarLauncher.java:65)
2024-02-02 01:48:05.6178 UTC [Blackduck Execution] INFO: com.synopsys.integration.detect.lifecycle.OperationException: com.synopsys.integration.rest.exception.IntegrationRestException: There was a problem trying to GET ***/api/developer-scans/d9934315-8823-4bc4-aa63-70b04b51eadd?offset=0&limit=100, response was 400 Bad Request, reason phrase was Bad Request.
2024-02-02 01:48:05.6178 UTC [Blackduck Execution] INFO: 	at com.synopsys.integration.detect.lifecycle.run.step.utility.OperationWrapper.wrapped(OperationWrapper.java:78)
2024-02-02 01:48:05.6178 UTC [Blackduck Execution] INFO: 	at com.synopsys.integration.detect.lifecycle.run.step.utility.OperationWrapper.wrapped(OperationWrapper.java:27)
2024-02-02 01:48:05.6178 UTC [Blackduck Execution] INFO: 	at com.synopsys.integration.detect.lifecycle.run.step.utility.OperationAuditLog.namedInternal(OperationAuditLog.java:53)
2024-02-02 01:48:05.6179 UTC [Blackduck Execution] INFO: 	at com.synopsys.integration.detect.lifecycle.run.step.utility.OperationAuditLog.namedInternal(OperationAuditLog.java:48)
2024-02-02 01:48:05.6179 UTC [Blackduck Execution] INFO: 	at com.synopsys.integration.detect.lifecycle.run.operation.OperationRunner.waitForFullRapidResults(OperationRunner.java:567)
2024-02-02 01:48:05.6179 UTC [Blackduck Execution] INFO: 	at com.synopsys.integration.detect.lifecycle.run.step.RapidModeStepRunner.runOnline(RapidModeStepRunner.java:123)
2024-02-02 01:48:05.6179 UTC [Blackduck Execution] INFO: 	at com.synopsys.integration.detect.lifecycle.run.DetectRun.run(DetectRun.java:86)
2024-02-02 01:48:05.6180 UTC [Blackduck Execution] INFO: 	at com.synopsys.integration.detect.Application.runApplication(Application.java:214)
2024-02-02 01:48:05.6180 UTC [Blackduck Execution] INFO: 	at com.synopsys.integration.detect.Application.run(Application.java:143)
2024-02-02 01:48:05.6180 UTC [Blackduck Execution] INFO: 	at org.springframework.boot.SpringApplication.callRunner(SpringApplication.java:759)
2024-02-02 01:48:05.6181 UTC [Blackduck Execution] INFO: 	at org.springframework.boot.SpringApplication.callRunners(SpringApplication.java:749)
2024-02-02 01:48:05.6181 UTC [Blackduck Execution] INFO: 	at org.springframework.boot.SpringApplication.run(SpringApplication.java:314)
2024-02-02 01:48:05.6181 UTC [Blackduck Execution] INFO: 	at org.springframework.boot.builder.SpringApplicationBuilder.run(SpringApplicationBuilder.java:164)
2024-02-02 01:48:05.6181 UTC [Blackduck Execution] INFO: 	at com.synopsys.integration.detect.Application.main(Application.java:97)
2024-02-02 01:48:05.6182 UTC [Blackduck Execution] INFO: 	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
2024-02-02 01:48:05.6182 UTC [Blackduck Execution] INFO: 	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
2024-02-02 01:48:05.6182 UTC [Blackduck Execution] INFO: 	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
2024-02-02 01:48:05.6182 UTC [Blackduck Execution] INFO: 	at java.base/java.lang.reflect.Method.invoke(Method.java:568)
2024-02-02 01:48:05.6183 UTC [Blackduck Execution] INFO: 	at org.springframework.boot.loader.MainMethodRunner.run(MainMethodRunner.java:49)
2024-02-02 01:48:05.6183 UTC [Blackduck Execution] INFO: 	at org.springframework.boot.loader.Launcher.launch(Launcher.java:108)
2024-02-02 01:48:05.6183 UTC [Blackduck Execution] INFO: 	at org.springframework.boot.loader.Launcher.launch(Launcher.java:58)
2024-02-02 01:48:05.6183 UTC [Blackduck Execution] INFO: 	at org.springframework.boot.loader.JarLauncher.main(JarLauncher.java:65)
2024-02-02 01:48:05.6184 UTC [Blackduck Execution] INFO: Caused by: com.synopsys.integration.rest.exception.IntegrationRestException: There was a problem trying to GET ***/api/developer-scans/d9934315-8823-4bc4-aa63-70b04b51eadd?offset=0&limit=100, response was 400 Bad Request, reason phrase was Bad Request.
2024-02-02 01:48:05.6184 UTC [Blackduck Execution] INFO: 	at com.synopsys.integration.rest.response.DefaultResponse.throwExceptionForError(DefaultResponse.java:210)
2024-02-02 01:48:05.6184 UTC [Blackduck Execution] INFO: 	at com.synopsys.integration.blackduck.http.client.DefaultBlackDuckHttpClient.throwExceptionForError(DefaultBlackDuckHttpClient.java:104)
2024-02-02 01:48:05.6184 UTC [Blackduck Execution] INFO: 	at com.synopsys.integration.blackduck.service.BlackDuckApiClient.execute(BlackDuckApiClient.java:166)
2024-02-02 01:48:05.6185 UTC [Blackduck Execution] INFO: 	at com.synopsys.integration.detect.workflow.blackduck.developer.blackduck.DetectRapidScanWaitJobFull.isComplete(DetectRapidScanWaitJobFull.java:60)
2024-02-02 01:48:05.6185 UTC [Blackduck Execution] INFO: 	at com.synopsys.integration.detect.workflow.blackduck.developer.blackduck.DetectRapidScanWaitJobFull.attemptJob(DetectRapidScanWaitJobFull.java:48)
2024-02-02 01:48:05.6185 UTC [Blackduck Execution] INFO: 	at com.synopsys.integration.wait.ResilientJobExecutor.executeJob(ResilientJobExecutor.java:34)
2024-02-02 01:48:05.6186 UTC [Blackduck Execution] INFO: 	at com.synopsys.integration.detect.workflow.blackduck.developer.RapidModeWaitOperation.waitForFullScans(RapidModeWaitOperation.java:36)
2024-02-02 01:48:05.6186 UTC [Blackduck Execution] INFO: 	at com.synopsys.integration.detect.lifecycle.run.operation.OperationRunner.lambda$waitForFullRapidResults$10(OperationRunner.java:570)
2024-02-02 01:48:05.6186 UTC [Blackduck Execution] INFO: 	at com.synopsys.integration.detect.lifecycle.run.step.utility.OperationWrapper.wrapped(OperationWrapper.java:36)
2024-02-02 01:48:05.6186 UTC [Blackduck Execution] INFO: 	... 21 common frames omitted
2024-02-02 01:48:05.0000 UTC [Blackduck Execution] [main] ERROR: --- ----------------------------------

I tried switching to trace level logging but it doesn't seems to provide any more information than the debug level. The configuration, as far as I can tell, are the same other than the logging level (which I added to try to troubleshoot) and the PR comment flag (but that is for the action, not for the detect itself).

@craigbroadman
Copy link

+1 on this.

Sometimes our scans work, other times they fail with this error. Why?

@guellaeq
Copy link

+1

I reproduce this exact same error systematically when the option "blackduck_prComment_enabled" is set to "true" and there are some issues to be reported.
I tried playing with different version of the action and different setups but nothing helps fixing it.
I currently use the latest released version of the action and it does not change anything.

@anitakrueger
Copy link

Same as @guellaeq I have been wanting to enable blackduck_prComment_enabled and am getting this error on every scan now.

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

No branches or pull requests

4 participants