aboutcode-org / scancode.io

ScanCode.io is a server to script and automate software composition analysis pipelines with ScanPipe pipelines. This project is sponsored by NLnet project https://nlnet.nl/project/vulnerabilitydatabase/ Google Summer of Code, nexB and others generous sponsors!
https://scancodeio.readthedocs.io
Apache License 2.0
114 stars 85 forks source link

Error when following tutorial #1407

Open pombredanne opened 1 week ago

pombredanne commented 1 week ago

I received a report of someone having issues with the docker image of scancode.io.

Here is the error:

And I had this error:

CommandError: Error during inspect_packages execution:
'str' object has no attribute 'path'
Traceback:
  File "/opt/scancodeio/scanpipe/pipelines/_init_.py", line 220, in execute
    step(self)
  File "/opt/scancodeio/scanpipe/pipelines/inspect_packages.py", line 61, in scan_for_application_packages
    scancode.scan_for_application_packages(
  File "/opt/scancodeio/scanpipe/pipes/scancode.py", line 408, in scan_for_application_packages
    assemble_packages(project=project)
  File "/opt/scancodeio/scanpipe/pipes/scancode.py", line 465, in assemble_packages
    for item in items:
  File "/opt/scancodeio/venv/lib/python3.12/site-packages/packagedcode/npm.py", line 120, in assemble
    workspace_root_path = package_resource.parent(codebase).path
pombredanne commented 1 week ago

To reproduce:

  1. git clone https://github.com/aboutcode-org/scancode-workbench
  2. docker run --rm -v "$(pwd)/scancode-workbench":/code ghcr.io/aboutcode-org/scancode.io:latest sh -c "run inspect_packages:StaticResolver /code" > results.json
  3. eventually this fails:
    
    INFO     Processing item: Dependency(purl='pkg:npm/zip-stream@5.0.1', extracted_requirement='5.0.1', scope='dependencies')
    INFO   Processing: package.json
    INFO   Package data: pkg:npm/scancode-workbench@4.0.3
    INFO   Selected package handler: NpmPackageJsonHandler
    INFO Run[370b760e-2b59-4885-9bc3-fce65957388e] Update Run instance with exitcode, output, and end_date
    CommandError: Error during inspect_packages execution:
    'str' object has no attribute 'path'

Traceback: File "/opt/scancodeio/aboutcode/pipeline/init.py", line 199, in execute step(self) File "/opt/scancodeio/scanpipe/pipelines/inspect_packages.py", line 61, in scan_for_application_packages scancode.scan_for_application_packages( File "/opt/scancodeio/scanpipe/pipes/scancode.py", line 409, in scan_for_application_packages assemble_packages(project=project) File "/opt/scancodeio/scanpipe/pipes/scancode.py", line 466, in assemble_packages for item in items: ^^^^^ File "/opt/scancodeio/.venv/lib/python3.12/site-packages/packagedcode/npm.py", line 120, in assemble workspace_root_path = package_resource.parent(codebase).path ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

pombredanne commented 1 week ago

To reproduce:

  1. git clone https://github.com/aboutcode-org/scancode-workbench
  2. docker run --rm -v "$(pwd)/scancode-workbench":/code ghcr.io/aboutcode-org/scancode.io:latest sh -c "run inspect_packages:StaticResolver /code" > results.json
  3. eventually this fails:
    
    INFO     Processing item: Dependency(purl='pkg:npm/zip-stream@5.0.1', extracted_requirement='5.0.1', scope='dependencies')
    INFO   Processing: package.json
    INFO   Package data: pkg:npm/scancode-workbench@4.0.3
    INFO   Selected package handler: NpmPackageJsonHandler
    INFO Run[370b760e-2b59-4885-9bc3-fce65957388e] Update Run instance with exitcode, output, and end_date
    CommandError: Error during inspect_packages execution:
    'str' object has no attribute 'path'

Traceback: File "/opt/scancodeio/aboutcode/pipeline/init.py", line 199, in execute step(self) File "/opt/scancodeio/scanpipe/pipelines/inspect_packages.py", line 61, in scan_for_application_packages scancode.scan_for_application_packages( File "/opt/scancodeio/scanpipe/pipes/scancode.py", line 409, in scan_for_application_packages assemble_packages(project=project) File "/opt/scancodeio/scanpipe/pipes/scancode.py", line 466, in assemble_packages for item in items: ^^^^^ File "/opt/scancodeio/.venv/lib/python3.12/site-packages/packagedcode/npm.py", line 120, in assemble workspace_root_path = package_resource.parent(codebase).path ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^



Current toolkit is 32.2.1 per https://github.com/aboutcode-org/scancode.io/blob/53700eb015039fbe28d3e08db3b9fac28fe4ac98/setup.cfg#L75

We likely have a fix with https://github.com/aboutcode-org/scancode-toolkit/pull/3857 and we likely just need to update SCTK and release SCIO
AyanSinhaMahapatra commented 1 week ago

We likely have a fix with https://github.com/aboutcode-org/scancode-toolkit/pull/3857 and we likely just need to update SCTK and release SCIO

This seems to be fixed by the above mentioned PR adding a bunch of npm improvements. Will push a release of SCTK and update sctk version in SCIO soon

tdruez commented 20 hours ago

@AyanSinhaMahapatra Is the problem still exist after the merge of https://github.com/aboutcode-org/scancode.io/pull/1418 ?

AyanSinhaMahapatra commented 19 hours ago

@tdruez this is fixed with the latest ghcr.io/aboutcode-org/scancode.io:v34.8.3 image.