Apisix-dashboard: bug: Failed to sync schema with APISIX via schema-sync.lua

Created on 7 Jan 2021  路  11Comments  路  Source: apache/apisix-dashboard

Bug report

Describe the bug

I would get the following errors at running ./api/build-tools/schema-sync.sh to sync schema definitions with APISIX.

lua: ./apisix/init.lua:24: module 'resty.ngxvar' not found:

and

lua: ./apisix/plugins/traffic-split.lua:21: module 'resty.roundrobin' not found:

After I added these two missing module names into fake_module_list variable. Everything works fine. So please have a check, if it's a bug, I would commit a PR to fix that. Thanks.

I guess this bug is similar to https://github.com/apache/apisix-dashboard/issues/1216 . PR #1221 had fixed part of it, we still need to add the missing resty.ngxvar and resty.roundrobin.

How to Reproduce

  1. Run ./api/build-tools/schema-sync.sh;
  2. See error above;

Expected behavior

The shell runs fine and the new schema.json is synchronized successfully.

System information

  • OS: macOS
  • Version: latest 190949c in master branch
backend bug

Most helpful comment

Does this should be fixed in M2.3?

@juzhiyuan , end users rarely run the script to sync schema. Meanwhile, this bug will not make any other impact on the functionality. So IMHO, this could be fixed until M2.4. Let's wait others opinions. Thanks.

All 11 comments

cc @nic-chen @starsz

Hi, @imjoey what's your apisix version.

Hi, @imjoey what's your apisix version.

@starsz I did not specify any argument or flag when running ./api/build-tools/schema-sync.sh, so it was downloading master branch of APISIX.

@imjoey Thanks for reporting. It's indeed a bug.
But I think there is a better solution. We can override the require function like this:

local old_require = require
require = function(...)
    local status, lib  = pcall(old_require, ...)
    if status then
        return lib
    end

    return {}
end

@starsz yep, your solution is really fantastic. Looking forward to your PR. Much appreciated. 馃槃

Does this should be fixed in M2.3?

Does this should be fixed in M2.3?

@juzhiyuan , end users rarely run the script to sync schema. Meanwhile, this bug will not make any other impact on the functionality. So IMHO, this could be fixed until M2.4. Let's wait others opinions. Thanks.

Does this should be fixed in M2.3?

@juzhiyuan , end users rarely run the script to sync schema. Meanwhile, this bug will not make any other impact on the functionality. So IMHO, this could be fixed until M2.4. Let's wait others opinions. Thanks.

Agree +1.

@starsz
we don't need the tool schema-sync now, we could use APISIX controlAPI to export schema.
we only need to update doc about sync schema here.

@nic-chen so we can update the doc and close this issue, right?

@nic-chen so we can update the doc and close this issue, right?

sure.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

juzhiyuan picture juzhiyuan  路  4Comments

juzhiyuan picture juzhiyuan  路  3Comments

Firstsawyou picture Firstsawyou  路  5Comments

juzhiyuan picture juzhiyuan  路  3Comments

imjoey picture imjoey  路  6Comments