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

TypeError when executing query through CLI #7044

Closed
2 of 21 tasks
peterjroberts opened this issue Nov 9, 2020 · 0 comments · Fixed by #7043
Closed
2 of 21 tasks

TypeError when executing query through CLI #7044

peterjroberts opened this issue Nov 9, 2020 · 0 comments · Fixed by #7043

Comments

@peterjroberts
Copy link
Contributor

peterjroberts commented Nov 9, 2020

Issue Description

In 0.2.29 when executing e.g. When executing a CLI query e.g. npx typeorm query -f path/to/ormconfig.js "query" "SELECT 1" we get a TypeError.

Error during query execution:
TypeError: Cannot read property 'replace' of undefined
    at escape (/projectPath/node_modules/highlight.js/lib/highlight.js:71:18)
    at Object.highlight (/projectPath/node_modules/highlight.js/lib/highlight.js:799:18)
    at Object.highlight (/projectPath/node_modules/cli-highlight/dist/index.js:76:21)
    at Function.PlatformTools.highlightSql (/projectPath/node_modules/typeorm/platform/PlatformTools.js:186:32)
    at Object.<anonymous> (/projectPath/node_modules/typeorm/commands/QueryCommand.js:64:110)
    at step (/projectPath/node_modules/tslib/tslib.js:141:27)
    at Object.next (/projectPath/node_modules/tslib/tslib.js:122:57)
    at fulfilled (/projectPath/node_modules/tslib/tslib.js:112:62)

Expected Behavior

The supplied query is executed:

Running query: SELECT 1
Query has been executed. Result:
[
  {
    "?column?": 1
  }
]

Actual Behavior

A TypeError is thrown

Error during query execution:
TypeError: Cannot read property 'replace' of undefined
    at escape (/projectPath/node_modules/highlight.js/lib/highlight.js:71:18)
    at Object.highlight (/projectPath/node_modules/highlight.js/lib/highlight.js:799:18)
    at Object.highlight (/projectPath/node_modules/cli-highlight/dist/index.js:76:21)
    at Function.PlatformTools.highlightSql (/projectPath/node_modules/typeorm/platform/PlatformTools.js:186:32)
    at Object.<anonymous> (/projectPath/node_modules/typeorm/commands/QueryCommand.js:64:110)
    at step (/projectPath/node_modules/tslib/tslib.js:141:27)
    at Object.next (/projectPath/node_modules/tslib/tslib.js:122:57)
    at fulfilled (/projectPath/node_modules/tslib/tslib.js:112:62)

Steps to Reproduce

  1. Execute a query through the CLI tool e.g. npx typeorm query -f path/to/ormconfig.js "query" "SELECT 1"

My Environment

Dependency Version
Operating System macOS 10.15.5
Node.js version v14.15.0
Typescript version v3.9.7
TypeORM version v0.2.29

Additional Context

Relevant Database Driver(s)

  • aurora-data-api
  • aurora-data-api-pg
  • better-sqlite3
  • cockroachdb
  • cordova
  • expo
  • mongodb
  • mysql
  • nativescript
  • oracle
  • postgres
  • react-native
  • sap
  • sqlite
  • sqlite-abstract
  • sqljs
  • sqlserver

Are you willing to resolve this issue by submitting a Pull Request?

  • Yes, I have the time, and I know how to start.
  • Yes, I have the time, but I don't know how to start. I would need guidance.
  • No, I don't have the time, although I believe I could do it if I had the time...
  • No, I don't have the time and I wouldn't even know how to start.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant