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

app-nuxt after build and yarn start, all pages and all route will be 404, in yarn dev work fine! #3402

Closed
bookyo opened this issue Aug 17, 2020 · 7 comments

Comments

@bookyo
Copy link

bookyo commented Aug 17, 2020

after update keystonejs to 13.0, app-nuxt build and start will cause this error.
QQ图片20200817115123
all route and all pages will be 404 like screenshot.

but in develop (yarn dev) , nuxt work fine. i think this maybe keystone in production not start nuxtjs server.

@bookyo bookyo changed the title app-nuxt after build and yarn start, all pages and all route will be 404, in yarn dev work file! app-nuxt after build and yarn start, all pages and all route will be 404, in yarn dev work fine! Aug 17, 2020
@bookyo
Copy link
Author

bookyo commented Aug 17, 2020

  "dependencies": {
    "@keystonejs/adapter-mongoose": "^9.0.0",
    "@keystonejs/app-admin-ui": "^7.3.0",
    "@keystonejs/app-graphql": "^6.0.0",
    "@keystonejs/app-nuxt": "^5.1.3",
    "@keystonejs/auth-password": "^5.1.11",
    "@keystonejs/fields": "^16.0.0",
    "@keystonejs/fields-authed-relationship": "^1.0.7",
    "@keystonejs/fields-wysiwyg-tinymce": "^5.3.1",
    "@keystonejs/file-adapters": "^7.0.2",
    "@keystonejs/keystone": "^13.1.1",
    "@keystonejs/list-plugins": "^7.0.3",
    "@keystonejs/server-side-graphql-client": "^1.1.1",
    "@nuxtjs/apollo": "^4.0.0-rc17",
    "@nuxtjs/moment": "latest",
    "axios": "^0.19.2",
    "connect-mongo": "^3.2.0",
    "core-js": "2.5.7",
    "cross-env": "^7.0.0",
    "dotenv": "^8.2.0",
    "express": "^4.17.1",
    "express-session": "^1.17.1",
    "graphql-tag": "^2.10.1",
    "lodash": "^4.17.19",
    "moment": "^2.27.0",
    "nuxt": "^2.14.0",
    "vuetify": "2.3.4",
    "vuetify-notify": "^1.0.6"
  },

@bookyo
Copy link
Author

bookyo commented Aug 17, 2020

I found use custom server can fix this issue.

  1. create server.js in project root path.
const express = require('express');
const { keystone, apps } = require('./index.js');

keystone
  .prepare({
    apps: apps,
    dev: process.env.NODE_ENV !== 'production',
  })
  .then(async ({ middlewares }) => {
    await keystone.connect();
    const app = express();
    app.set('trust proxy', true);
    app.use(middlewares).listen(3000);
  });
  1. yarn build
  2. start server in production
NODE_ENV=production node server.js

project work fine like before keytonejs 12.0.

@joselcvarela
Copy link

I am getting this error too (404 NOT FOUND) on GET /admin.
But in development everything runs fine.

I am using Postgres inside Docker, but I don't think that can be related.

@joselcvarela
Copy link

I could finally solve this issue, but yarn build fails silently and shows success at the end.
The problem was in @keystonejs/fields package. I have a deprecated version installed (it has dependencies on @apollo/react-hooks, but this package is not maintained anymore).

So in order to solve the problem you just need yarn add @keystonjs/fields@latest.

Curiosly this not happens in development mode.

NOTE: I have created a project about a 2 weeks ago with CLI but it seems some packages installed have old versions which causes errors. In other words, the project installed with CLI is not ready to use right away (at least for me).

@bookyo
Copy link
Author

bookyo commented Aug 20, 2020

@joselcvarela my issue i think maybe /packages/keystone/bin/commands updated cause it. few days ago dev.js and start.js update, and update keystone to 13.0 will cause my issue, in production nuxt-app not start in keystone server, maybe connect middleware fail. I use custom server, and use apps in middleware solved this issue.

@stale
Copy link

stale bot commented Dec 19, 2020

It looks like there hasn't been any activity here in over 6 months. Sorry about that! We've flagged this issue for special attention. It wil be manually reviewed by maintainers, not automatically closed. If you have any additional information please leave us a comment. It really helps! Thank you for you contribution. :)

@stale stale bot added the needs-review label Dec 19, 2020
@bladey
Copy link
Contributor

bladey commented Apr 8, 2021

Keystone 5 has officially moved into active maintenance mode as we push towards the next major new version Keystone Next, you can find out more information about this transition here.

In an effort to sustain the project going forward, we're cleaning up and closing old issues such as this one. If you feel this issue is still relevant for Keystone Next, please let us know.

@bladey bladey closed this as completed Apr 8, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants