When in localhost AdminBro bundle function is taking path, but when deployed to the Vercel production getting error, why?

524 Views Asked by At

In the local server, it is working correctly. Only when deployed to Vercel getting this error.

This is the following code - (The error is occurring in the AdminBro.bundle as it is not taking the argument.)

imagePath: {
            isVisible: { list: false, filter: false, show: true, edit: true },
            components: {
              show: AdminBro.bundle(
                "components/admin-imgPath-component.jsx"
              ),
            },
          },

The error I am getting.

2021-08-26T18:14:08.075Z    undefined   ERROR   ConfigurationError: 
    Given file "components/admin-imgPath-component.jsx", doesn't exist.
    More information can be found at: https://softwarebrothers.github.io/admin-bro-dev/AdminBro.html
    at Function.bundle (/var/task/node_modules/admin-bro/lib/admin-bro.js:375:13)
    at Object.<anonymous> (/var/task/routes/admin.js:47:30)
    at Module._compile (internal/modules/cjs/loader.js:1072:14)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1101:10)
    at Module.load (internal/modules/cjs/loader.js:937:32)
    at Function.Module._load (internal/modules/cjs/loader.js:778:12)
    at Module.require (internal/modules/cjs/loader.js:961:19)
    at require (internal/modules/cjs/helpers.js:92:18)
    at Object.<anonymous> (/var/task/app.js:25:21)
    at Module._compile (internal/modules/cjs/loader.js:1072:14)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1101:10)
    at Module.load (internal/modules/cjs/loader.js:937:32)
    at Function.Module._load (internal/modules/cjs/loader.js:778:12)
    at ModuleWrap.<anonymous> (internal/modules/esm/translators.js:199:29)
    at ModuleJob.run (internal/modules/esm/module_job.js:170:25)
    at async Loader.import (internal/modules/esm/loader.js:178:24)
RequestId: ce1bf09a-857f-4c40-8a3b-e8a1762590bb Error: Runtime exited with error: exit status 1
Runtime.ExitError
1

There are 1 best solutions below

0
On

You have to call

show: AdminBro.bundle(
            "components/admin-imgPath-component"
          ),

WITHOUT extension at the end. Make sure that adminjs automatically generates an folder with file .adminjs/.entry.js where the Component gets linked to the AdminJS instance.