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

A TypeError is thrown when using Designer #16853

Closed
liviuconcioiu opened this issue Apr 25, 2021 · 18 comments · Fixed by #17411
Closed

A TypeError is thrown when using Designer #16853

liviuconcioiu opened this issue Apr 25, 2021 · 18 comments · Fixed by #17411
Assignees
Labels
Bug A problem or regression with an existing feature has-pr An issue that has a pull request pending that may fix this issue. The pull request may be incomplete
Projects
Milestone

Comments

@liviuconcioiu
Copy link
Contributor

liviuconcioiu commented Apr 25, 2021

Describe the bug

A TypeError is thrown when using Designer.

To Reproduce

Steps to reproduce the behavior:

  1. Go to https://demo.phpmyadmin.net/master-config/index.php?route=/
  2. Select a database
  3. Click on Designer
  4. Click on Move Menu
  5. Click on Delete pages
  6. See error

Screenshots

1

Client configuration

  • Browser: Firefox
  • Operating system: Windows

Additional context

{
    "pma_version": "5.2.0-dev",
    "browser_name": "FIREFOX",
    "browser_version": "90.0",
    "user_os": "Win",
    "server_software": "nginx/1.14.2",
    "user_agent_string": "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:90.0) Gecko/20100101 Firefox/90.0",
    "locale": "en",
    "configuration_storage": "disabled",
    "php_version": "7.4.14",
    "script_name": "index.php",
    "exception_type": "js",
    "exception": {
        "mode": "stack",
        "name": "TypeError",
        "message": "can't access property \"transaction\", db is null",
        "stack": [
            {
                "func": "DesignerOfflineDB</designerDB.loadAllObjects",
                "line": "66",
                "column": "23",
                "context": [
                    "    cursorRequest.onerror = designerDB.onerror;",
                    "  };",
                    "",
                    "  designerDB.loadAllObjects = function (table, callback) {",
                    "    var db = datastore;",
                    "    var transaction = db.transaction([table], 'readwrite');",
                    "    var objStore = transaction.objectStore(table);",
                    "    var keyRange = IDBKeyRange.lowerBound(0);",
                    "    var cursorRequest = objStore.openCursor(keyRange);",
                    "    var results = [];",
                    ""
                ],
                "uri": "js/dist/designer/database.js?v=5.2.0-dev",
                "scriptname": "js/dist/designer/database.js"
            },
            {
                "func": "DesignerPage.createPageList",
                "line": "81",
                "column": "21",
                "context": [
                    "DesignerPage.saveTablePositions = function (positions, callback) {",
                    "  DesignerOfflineDB.addObject('table_coords', positions, callback);",
                    "};",
                    "",
                    "DesignerPage.createPageList = function (db, callback) {",
                    "  DesignerOfflineDB.loadAllObjects('pdf_pages', function (pages) {",
                    "    var html = '';",
                    "",
                    "    for (var p = 0; p < pages.length; p++) {",
                    "      var page = pages[p];",
                    ""
                ],
                "uri": "js/dist/designer/page.js?v=5.2.0-dev",
                "scriptname": "js/dist/designer/page.js"
            },
            {
                "func": "DesignerMove.deletePages/<",
                "line": "996",
                "column": "22",
                "context": [
                    "      Functions.ajaxShowMessage(data.error, false);",
                    "    } else {",
                    "      Functions.ajaxRemoveMessage($msgbox);",
                    "",
                    "      if (!designerTablesEnabled) {",
                    "        DesignerPage.createPageList(db, function (options) {",
                    "          $('#selected_page').append(options);",
                    "        });",
                    "      }",
                    "",
                    "      $('<div id=\"page_delete_dialog\"></div>').append(data.message).dialog({"
                ],
                "uri": "js/dist/designer/move.js?v=5.2.0-dev",
                "scriptname": "js/dist/designer/move.js"
            },
            {
                "func": "c",
                "line": "2",
                "column": "28327",
                "context": [
                    "/*! jQuery v3.6.0 | (c) OpenJS Foundation and other contributors | jquery.o//...",
                    "!function(e,t){\"use strict\";\"object\"==typeof module&&\"object\"==typeof modul//...",
                    ""
                ],
                "uri": "js/vendor/jquery/jquery.min.js?v=5.2.0-dev",
                "scriptname": "js/vendor/jquery/jquery.min.js"
            },
            {
                "func": "fireWith",
                "line": "2",
                "column": "29072",
                "context": [
                    "/*! jQuery v3.6.0 | (c) OpenJS Foundation and other contributors | jquery.o//...",
                    "!function(e,t){\"use strict\";\"object\"==typeof module&&\"object\"==typeof modul//...",
                    ""
                ],
                "uri": "js/vendor/jquery/jquery.min.js?v=5.2.0-dev",
                "scriptname": "js/vendor/jquery/jquery.min.js"
            },
            {
                "func": "l",
                "line": "2",
                "column": "79901",
                "context": [
                    "/*! jQuery v3.6.0 | (c) OpenJS Foundation and other contributors | jquery.o//...",
                    "!function(e,t){\"use strict\";\"object\"==typeof module&&\"object\"==typeof modul//...",
                    ""
                ],
                "uri": "js/vendor/jquery/jquery.min.js?v=5.2.0-dev",
                "scriptname": "js/vendor/jquery/jquery.min.js"
            },
            {
                "func": "o/<",
                "line": "2",
                "column": "82355",
                "context": [
                    "/*! jQuery v3.6.0 | (c) OpenJS Foundation and other contributors | jquery.o//...",
                    "!function(e,t){\"use strict\";\"object\"==typeof module&&\"object\"==typeof modul//...",
                    ""
                ],
                "uri": "js/vendor/jquery/jquery.min.js?v=5.2.0-dev",
                "scriptname": "js/vendor/jquery/jquery.min.js"
            }
        ],
        "uri": "index.php?route=%2Fdatabase%2Fdesigner"
    }
}
@williamdes
Copy link
Member

Param Value
Error Type TypeError
Error Message Cannot read property 'transaction' of null
Exception Type js
phpMyAdmin version 4.8.3
Incident count 376
Link Report#52586

This comment is posted automatically by phpMyAdmin's error-reporting-server.

@williamdes williamdes added the Bug A problem or regression with an existing feature label Apr 25, 2021
@williamdes williamdes added this to Needs triage in issues via automation Apr 25, 2021
@williamdes
Copy link
Member

I think this also affects 5.1, right?

@liviuconcioiu
Copy link
Contributor Author

I think this also affects 5.1, right?

Yes.

@williamdes
Copy link
Member

Would you mind providing a fix for this issue ?
I am not sure how to reproduce it :)

@shucon
Copy link
Contributor

shucon commented May 10, 2021

Hey @liviuconcioiu, I'm unable to reproduce the issue using your instructions. Can you please check whether it's database-specific or you're able to reproduce it on any database?

@williamdes williamdes moved this from Needs triage to Not reproduced in issues May 10, 2021
@liviuconcioiu
Copy link
Contributor Author

@shucon go to https://demo.phpmyadmin.net/master-config/index.php?route=/database/designer&db=kek, open the menu and click on Delete pages. I cannot reproduce it on localhost, only on remote.

@shucon
Copy link
Contributor

shucon commented May 27, 2021

Hey @liviuconcioiu, I'm still unable to reproduce the issue. Maybe a video would help?

@liviuconcioiu
Copy link
Contributor Author

@shucon

27.05.2021_17.34.01_REC.mp4

@shucon
Copy link
Contributor

shucon commented May 27, 2021

It's very strange, I used the Computer25 db you are using, but I'm still unable to reproduce it. Can you try hard refreshing the page and try once? I'll try to reproduce it on Windows system as well, I'm currently using Ubuntu 20.10.

@liviuconcioiu
Copy link
Contributor Author

I've tried and it still occurs. Is affecting only Firefox. I've tried in troubleshoot mode too.

@shucon
Copy link
Contributor

shucon commented May 27, 2021

I've tried and it still occurs. Is affecting only Firefox. I've tried in troubleshoot mode too.

It's not an issue on Firefox, ubuntu. I'll try windows once.

williamdes added a commit to phpmyadmin/error-reporting-server that referenced this issue May 30, 2021
… environment

Set date to RFC3339

Used data from: phpmyadmin/phpmyadmin#16853

Signed-off-by: William Desportes <williamdes@wdes.fr>
@williamdes williamdes added this to the 5.1.2 milestone Jun 1, 2021
@williamdes williamdes modified the milestones: 5.1.2, 5.1.3 Aug 14, 2021
@shucontech
Copy link
Contributor

shucontech commented Oct 3, 2021

I think the issue won't occur now. The code has been changed and the stack trace is old. The new change fixes the issue and should be closed. The issue was not reproducible on Windows as well.
Ref:

var transaction = designerDB.getTransaction(table);

@liviuconcioiu
Copy link
Contributor Author

liviuconcioiu commented Oct 3, 2021

Just tested now, and the bug is still there, Firefox 93/Windows.

{
    "pma_version": "5.2.0-dev",
    "browser_name": "FIREFOX",
    "browser_version": "93.0",
    "user_os": "Win",
    "server_software": "nginx/1.14.2",
    "user_agent_string": "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:93.0) Gecko/20100101 Firefox/93.0",
    "locale": "en",
    "configuration_storage": "disabled",
    "php_version": "7.4.23",
    "script_name": "index.php",
    "exception_type": "js",
    "exception": {
        "mode": "stack",
        "name": "TypeError",
        "message": "can't access property \"transaction\", datastore is null",
        "stack": [
            {
                "func": "DesignerOfflineDB</designerDB.getTransaction",
                "line": "26",
                "column": "5",
                "context": [
                    "   * @param {String} table",
                    "   * @return {IDBTransaction}",
                    "   */",
                    "",
                    "  designerDB.getTransaction = function (table) {",
                    "    return datastore.transaction([table], 'readwrite');",
                    "  };",
                    "  /**",
                    "   * @param {String} table",
                    "   * @return {IDBObjectStore}",
                    "   */"
                ],
                "uri": "js/dist/designer/database.js?v=5.2.0-dev",
                "scriptname": "js/dist/designer/database.js"
            },
            {
                "func": "DesignerOfflineDB</designerDB.loadAllObjects",
                "line": "117",
                "column": "34",
                "context": [
                    "   * @return {void}",
                    "   */",
                    "",
                    "",
                    "  designerDB.loadAllObjects = function (table, callback) {",
                    "    var transaction = designerDB.getTransaction(table);",
                    "    var cursorRequest = designerDB.getCursorRequest(transaction, table);",
                    "    var results = [];",
                    "",
                    "    transaction.oncomplete = function () {",
                    "      callback(results);"
                ],
                "uri": "js/dist/designer/database.js?v=5.2.0-dev",
                "scriptname": "js/dist/designer/database.js"
            },
            {
                "func": "DesignerPage.createPageList",
                "line": "81",
                "column": "21",
                "context": [
                    "DesignerPage.saveTablePositions = function (positions, callback) {",
                    "  DesignerOfflineDB.addObject('table_coords', positions, callback);",
                    "};",
                    "",
                    "DesignerPage.createPageList = function (db, callback) {",
                    "  DesignerOfflineDB.loadAllObjects('pdf_pages', function (pages) {",
                    "    var html = '';",
                    "",
                    "    for (var p = 0; p < pages.length; p++) {",
                    "      var page = pages[p];",
                    ""
                ],
                "uri": "js/dist/designer/page.js?v=5.2.0-dev",
                "scriptname": "js/dist/designer/page.js"
            },
            {
                "func": "DesignerMove.deletePages/<",
                "line": "930",
                "column": "22",
                "context": [
                    "      Functions.ajaxShowMessage(data.error, false);",
                    "    } else {",
                    "      Functions.ajaxRemoveMessage($msgbox);",
                    "",
                    "      if (!designerTablesEnabled) {",
                    "        DesignerPage.createPageList(db, function (options) {",
                    "          $('#selected_page').append(options);",
                    "        });",
                    "      }",
                    "",
                    "      var modal = DesignerMove.displayModal(data.message, Messages.strDelet//..."
                ],
                "uri": "js/dist/designer/move.js?v=5.2.0-dev",
                "scriptname": "js/dist/designer/move.js"
            },
            {
                "func": "c",
                "line": "2",
                "column": "28327",
                "context": [
                    "/*! jQuery v3.6.0 | (c) OpenJS Foundation and other contributors | jquery.o//...",
                    "!function(e,t){\"use strict\";\"object\"==typeof module&&\"object\"==typeof modul//...",
                    ""
                ],
                "uri": "js/vendor/jquery/jquery.min.js?v=5.2.0-dev",
                "scriptname": "js/vendor/jquery/jquery.min.js"
            },
            {
                "func": "fireWith",
                "line": "2",
                "column": "29072",
                "context": [
                    "/*! jQuery v3.6.0 | (c) OpenJS Foundation and other contributors | jquery.o//...",
                    "!function(e,t){\"use strict\";\"object\"==typeof module&&\"object\"==typeof modul//...",
                    ""
                ],
                "uri": "js/vendor/jquery/jquery.min.js?v=5.2.0-dev",
                "scriptname": "js/vendor/jquery/jquery.min.js"
            },
            {
                "func": "l",
                "line": "2",
                "column": "79901",
                "context": [
                    "/*! jQuery v3.6.0 | (c) OpenJS Foundation and other contributors | jquery.o//...",
                    "!function(e,t){\"use strict\";\"object\"==typeof module&&\"object\"==typeof modul//...",
                    ""
                ],
                "uri": "js/vendor/jquery/jquery.min.js?v=5.2.0-dev",
                "scriptname": "js/vendor/jquery/jquery.min.js"
            },
            {
                "func": "o/<",
                "line": "2",
                "column": "82355",
                "context": [
                    "/*! jQuery v3.6.0 | (c) OpenJS Foundation and other contributors | jquery.o//...",
                    "!function(e,t){\"use strict\";\"object\"==typeof module&&\"object\"==typeof modul//...",
                    ""
                ],
                "uri": "js/vendor/jquery/jquery.min.js?v=5.2.0-dev",
                "scriptname": "js/vendor/jquery/jquery.min.js"
            }
        ],
        "uri": "index.php?route=%2Fdatabase%2Fdesigner"
    }
}

@shucontech
Copy link
Contributor

Ahh, I think I understood what's happening. The request window.indexedDB.open('pma_designer', version) is failing for some reason. In the video I can see the console log for the error before can't access property "transaction", db is null.

@shucontech
Copy link
Contributor

@liviuconcioiu can you please post the output of the error console log here?
Screenshot from 2021-10-03 17-24-05

@shucontech
Copy link
Contributor

Can you please confirm whether the issue is happening in Private window only? I was finally able to reproduce it in a private window. Related issues: https://bugzilla.mozilla.org/show_bug.cgi?id=781982 , https://stackoverflow.com/questions/31159316/detecting-preventing-firefox-indexeddb-invalidstateerror-caused-by-private-brows

@liviuconcioiu
Copy link
Contributor Author

I'm not on a private window, but probably due to my settings.

error1

@shucontech
Copy link
Contributor

If tracking/history is turned off or the tab is in a private window, indexedDB does not work for firefox. The possible solution is to either refactor the code so that it does not use indexedDB or we can show a modal saying Your browser does not support indexedDB. Are you using firefox in private window or with tracking disabled? . Thoughts @williamdes @ibennetch ?

@ibennetch ibennetch modified the milestones: 5.1.3, 5.1.4 Feb 11, 2022
@MauricioFauth MauricioFauth added the has-pr An issue that has a pull request pending that may fix this issue. The pull request may be incomplete label Feb 20, 2022
@MauricioFauth MauricioFauth self-assigned this Feb 21, 2022
MauricioFauth added a commit that referenced this issue Feb 21, 2022
[ci skip]

Signed-off-by: Maurício Meneghini Fauth <mauricio@fauth.dev>
issues automation moved this from Not reproduced to Closed Feb 21, 2022
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Feb 22, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Bug A problem or regression with an existing feature has-pr An issue that has a pull request pending that may fix this issue. The pull request may be incomplete
Projects
issues
  
Closed
Development

Successfully merging a pull request may close this issue.

6 participants