sidorares / sidorares/node-mysql2

TypeError: Cannot read property 'replace' of undefined

Open
#899 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
4.4k
Forks
680
Avg merge
9h 7m
Merged PRs (30d)
59

Description

mysql2 is not working after minifying the code with uglify-es module. Minification error logs are given below for your reference.

node_modules/mysql2/index.js []
node_modules/mysql2/lib/auth_41.js []
node_modules/mysql2/lib/commands/binlog_dump.js []
node_modules/mysql2/lib/commands/change_user.js []
node_modules/mysql2/lib/commands/client_handshake.js []
node_modules/mysql2/lib/commands/close_statement.js []
node_modules/mysql2/lib/commands/command.js []
node_modules/mysql2/lib/commands/execute.js []
node_modules/mysql2/lib/commands/index.js []
TypeError: Cannot read property 'replace' of undefined
    at make_string (eval at <anonymous> (/Users/NatarajanG/BitBucket/mission/mission.shrink/node_modules/uglify-es/tools/node.js:21:1), <anonymous>:5645:19)
    at encode_string (eval at <anonymous> (/Users/NatarajanG/BitBucket/mission/mission.shrink/node_modules/uglify-es/tools/node.js:21:1), <anonymous>:5689:19)
    at Object.print_string (eval at <anonymous> (/Users/NatarajanG/BitBucket/mission/mission.shrink/node_modules/uglify-es/tools/node.js:21:1), <anonymous>:6107:27)
    at eval (eval at <anonymous> (/Users/NatarajanG/BitBucket/mission/mission.shrink/node_modules/uglify-es/tools/node.js:21:1), <anonymous>:6396:16)
    at doit (eval at <anonymous> (/Users/NatarajanG/BitBucket/mission/mission.shrink/node_modules/uglify-es/tools/node.js:21:1), <anonymous>:6168:13)
    at AST_Directive.eval (eval at <anonymous> (/Users/NatarajanG/BitBucket/mission/mission.shrink/node_modules/uglify-es/tools/node.js:21:1), <anonymous>:6175:13)
    at eval (eval at <anonymous> (/Users/NatarajanG/BitBucket/mission/mission.shrink/node_modules/uglify-es/tools/node.js:21:1), <anonymous>:6438:22)
    at Array.forEach (<anonymous>)
    at display_body (eval at <anonymous> (/Users/NatarajanG/BitBucket/mission/mission.shrink/node_modules/uglify-es/tools/node.js:21:1), <anonymous>:6429:14)
    at eval (eval at <anonymous> (/Users/NatarajanG/BitBucket/mission/mission.shrink/node_modules/uglify-es/tools/node.js:21:1), <anonymous>:6463:9) []
node_modules/mysql2/lib/commands/ping.js []
node_modules/mysql2/lib/commands/prepare.js []
node_modules/mysql2/lib/commands/query.js []
node_modules/mysql2/lib/commands/quit.js []
node_modules/mysql2/lib/commands/register_slave.js []
node_modules/mysql2/lib/commands/server_handshake.js []
node_modules/mysql2/lib/compressed_protocol.js []
node_modules/mysql2/lib/connection_config.js []
node_modules/mysql2/lib/connection.js []
node_modules/mysql2/lib/constants/charset_encodings.js []
node_modules/mysql2/lib/constants/charsets.js []
node_modules/mysql2/lib/constants/client.js []
node_modules/mysql2/lib/constants/commands.js []
node_modules/mysql2/lib/constants/cursor.js []
node_modules/mysql2/lib/constants/encoding_charset.js []
node_modules/mysql2/lib/constants/errors.js []
node_modules/mysql2/lib/constants/field_flags.js []
node_modules/mysql2/lib/constants/server_status.js []
node_modules/mysql2/lib/constants/ssl_profiles.js []
node_modules/mysql2/lib/constants/types.js []
node_modules/mysql2/lib/helpers.js []
node_modules/mysql2/lib/packet_parser.js []
node_modules/mysql2/lib/packets/auth_switch_request_more_data.js []
node_modules/mysql2/lib/packets/auth_switch_request.js []
node_modules/mysql2/lib/packets/auth_switch_response.js []
node_modules/mysql2/lib/packets/binary_row.js []
node_modules/mysql2/lib/packets/binlog_dump.js []
node_modules/mysql2/lib/packets/binlog_query_statusvars.js []
node_modules/mysql2/lib/packets/change_user.js []
node_modules/mysql2/lib/packets/close_statement.js []
node_modules/mysql2/lib/packets/column_definition.js []
node_modules/mysql2/lib/packets/execute.js []
node_modules/mysql2/lib/packets/handshake_response.js []
node_modules/mysql2/lib/packets/handshake.js []
node_modules/mysql2/lib/packets/index.js []
TypeError: Cannot read property 'replace' of undefined
    at make_string (eval at <anonymous> (/Users/NatarajanG/BitBucket/mission/mission.shrink/node_modules/uglify-es/tools/node.js:21:1), <anonymous>:5645:19)
    at encode_string (eval at <anonymous> (/Users/NatarajanG/BitBucket/mission/mission.shrink/node_modules/uglify-es/tools/node.js:21:1), <anonymous>:5689:19)
    at Object.print_string (eval at <anonymous> (/Users/NatarajanG/BitBucket/mission/mission.shrink/node_modules/uglify-es/tools/node.js:21:1), <anonymous>:6107:27)
    at eval (eval at <anonymous> (/Users/NatarajanG/BitBucket/mission/mission.shrink/node_modules/uglify-es/tools/node.js:21:1), <anonymous>:6396:16)
    at doit (eval at <anonymous> (/Users/NatarajanG/BitBucket/mission/mission.shrink/node_modules/uglify-es/tools/node.js:21:1), <anonymous>:6168:13)
    at AST_Directive.eval (eval at <anonymous> (/Users/NatarajanG/BitBucket/mission/mission.shrink/node_modules/uglify-es/tools/node.js:21:1), <anonymous>:6175:13)
    at eval (eval at <anonymous> (/Users/NatarajanG/BitBucket/mission/mission.shrink/node_modules/uglify-es/tools/node.js:21:1), <anonymous>:6438:22)
    at Array.forEach (<anonymous>)
    at display_body (eval at <anonymous> (/Users/NatarajanG/BitBucket/mission/mission.shrink/node_modules/uglify-es/tools/node.js:21:1), <anonymous>:6429:14)
    at eval (eval at <anonymous> (/Users/NatarajanG/BitBucket/mission/mission.shrink/node_modules/uglify-es/tools/node.js:21:1), <anonymous>:6463:9) []
node_modules/mysql2/lib/packets/packet.js []
node_modules/mysql2/lib/packets/prepare_statement.js []
node_modules/mysql2/lib/packets/prepared_statement_header.js []
node_modules/mysql2/lib/packets/query.js []
node_modules/mysql2/lib/packets/register_slave.js []
node_modules/mysql2/lib/packets/resultset_header.js []
node_modules/mysql2/lib/packets/ssl_request.js []
node_modules/mysql2/lib/packets/text_row.js []
node_modules/mysql2/lib/parsers/binary_parser.js []
node_modules/mysql2/lib/parsers/parser_cache.js []
node_modules/mysql2/lib/parsers/string.js []
node_modules/mysql2/lib/parsers/text_parser.js []
node_modules/mysql2/lib/pool_cluster.js []
node_modules/mysql2/lib/pool_config.js []
node_modules/mysql2/lib/pool_connection.js []
node_modules/mysql2/lib/pool.js []
node_modules/mysql2/lib/results_stream.js []
node_modules/mysql2/lib/server.js []
node_modules/mysql2/node_modules/iconv-lite/encodings/dbcs-codec.js []
node_modules/mysql2/node_modules/iconv-lite/encodings/dbcs-data.js []
node_modules/mysql2/node_modules/iconv-lite/encodings/index.js []
node_modules/mysql2/node_modules/iconv-lite/encodings/internal.js []
node_modules/mysql2/node_modules/iconv-lite/encodings/sbcs-codec.js []
node_modules/mysql2/node_modules/iconv-lite/encodings/sbcs-data-generated.js []
node_modules/mysql2/node_modules/iconv-lite/encodings/sbcs-data.js []
node_modules/mysql2/node_modules/iconv-lite/encodings/utf16.js []
node_modules/mysql2/node_modules/iconv-lite/encodings/utf7.js []
node_modules/mysql2/node_modules/iconv-lite/lib/bom-handling.js []
node_modules/mysql2/node_modules/iconv-lite/lib/extend-node.js []
node_modules/mysql2/node_modules/iconv-lite/lib/index.js []
node_modules/mysql2/node_modules/iconv-lite/lib/streams.js []
node_modules/mysql2/promise.js []

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the reported uglify-es minification failure against the mysql2 entry point and the listed files, especially node_modules/mysql2/index.js and lib/packets/index.js. Trace the TypeError from uglify-es's make_string call and verify that minifying the mysql2 package completes without the reported error.

Written by the indexing model from the issue text.

Assessment

Tech stack
mysql, nodejs
Domain
backend, databases
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.