getappmap / getappmap/appmap-js
Scanner fails if SQL contains an array
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 53
- Forks
- 18
- Avg merge
- 3d 18h
- Merged PRs (30d)
- 8
Description
If a sql_query in an AppMap contains an array, an exception gets thrown and scanning hangs. For example, if this AppMap is scanned
test_ranking_size_is_limited.appmap.json.gz, this happens:
ajp@Alans-MacBook-Pro r % npx @appland/scanner scan --all -f test_ranking_size_is_limited.appmap.json
Using scanner configuration file /Users/ajp/.npm/_npx/c11b5b1848416993/node_modules/@appland/scanner/built/sampleConfig/default.yml
Scanning [██████████████████░░░░░░░░░░░░░░░░░░░░░░] 45% | 5/11Cannot read properties of null (reading 'type')
Scanning [████████████████████████████████████░░░░] 90% | 10/11
The exception gets thrown from this statement:
https://github.com/applandinc/appmap-js/blob/main/packages/models/src/event/hash.js#L13 , because value is null.
This particular case is caused by https://github.com/applandinc/sql-parser/issues/10. But, in general, abstractSqlAstJSON should be prepared for value to be null.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in packages/models/src/event/hash.js at the linked statement where value.type is read, then reproduce the failure with the provided AppMap and npx @appland/scanner scan --all -f test_ranking_size_is_limited.appmap.json. Done means scanning an AppMap containing a SQL array no longer throws or hangs when the parsed value is null.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- sql, typescript
- Domain
- backend, tooling
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 48/100