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

Production build failing with "unexpected call to getAdminMetaInRelationshipField" error #8791

Open
ttbarnes opened this issue Aug 30, 2023 · 2 comments
Assignees
Labels
🐛 bug Unresolved bug

Comments

@ttbarnes
Copy link
Contributor

ttbarnes commented Aug 30, 2023

When running keystone build via npm scripts with NODE_ENV set to "production", I get the following error:

Error: unexpected call to getAdminMetaInRelationshipField
    at Object.getAdminMetaForRelationshipField (/Users/tony/project-x/src/api/node_modules/@keystone-6/core/dist/create-admin-meta-5d6c7c4d.cjs.prod.js:152:11)
    at Object.getAdminMeta (/Users/tony/project-x/src/api/node_modules/@keystone-6/core/fields/dist/keystone-6-core-fields.cjs.prod.js:2882:45)
    at Object.createAdminMeta (/Users/tony/project-x/src/api/node_modules/@keystone-6/core/dist/create-admin-meta-d9f6d1a4.cjs.dev.js:141:245)
    at Object.createSystem (/Users/tony/project-x/src/api/node_modules/@keystone-6/core/dist/createSystem-6881942b.cjs.dev.js:2182:37)
    at build (/Users/tony/project-x/src/api/node_modules/@keystone-6/core/scripts/cli/dist/keystone-6-core-scripts-cli.cjs.dev.js:519:20)

It also happens when adding the "no ui" flag: keystone build --no-ui.

It works perfectly when NODE_ENV set to "development".

keystone.ts:

export default withAuth(
  config({
    db: {
      provider: 'mysql',
      url: DB_URL,
    },
    lists,
    session,
  })
);

lists and session are not doing anything out of the ordinary and are following the examples.

I expect the build to be successful - it has been for quite some time, but it seems that some recent changes (in my codebase) are causing this error. It looks like keystone is failing with some currentAdminMeta logic in create-admin-meta.ts and not surfacing some more contextual information.

Should it be trying to create admin related things even with --no-ui?

I appreciate this is more than likely something in my codebase. Struggling to find what the cause could be. I've removed or simplified a lot of the setup to try and get the build working, but keep getting this error.

How or why would this be happening please?

  • Node version v19.4.0. Also tried previous versions e.g v18.16.0.
@ttbarnes
Copy link
Contributor Author

For anyone who comes across this - for now, setting the NODE_ENV in npm scripts works as per this comment.

"build": "NODE_ENV=production keystone build"

Having it set in a .env file doesn't work and causes the above error RE getAdminMetaInRelationshipField.

@aditya162002
Copy link

can i try to solve it?

@dcousens dcousens added the 🐛 bug Unresolved bug label Nov 14, 2023
@dcousens dcousens self-assigned this Nov 14, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🐛 bug Unresolved bug
Projects
None yet
Development

No branches or pull requests

3 participants