Payload doesn't start up

default discord avatar
mauroencinas
9 months ago
1 3

Bug Report

Trying to start the project after using npx create-payload-app inside a docker image (node:18-alpine) is impossible. The project does not start.

this is the docs that I'm using https://payloadcms.com/docs/getting-started/installation

Is there something I'm doing wrong?, thanks for your help guys.

Steps to Reproduce

  1. Initialize docker container (node:18-alpine)
  2. Run npx create-payload-app
  3. Install completes successfully
  4. Run yarn dev
  5. Project doesn't start.

Other Details

** Log using nodemon: **

/home/node/app # npx create-payload-app
Need to install the following packages:
  create-payload-app@0.3.24
Ok to proceed? (y) y

  Welcome to Payload. Let's create a project! 

✔ Project name? … payload-cms
✔ Choose project template › blog
✔ Enter MongoDB connection … mongodb://secret:secretpass@mongodb:27017/payload?authSource=admin 

  Creating a new Payload app in /home/node/app/payload-cms

✔ Project directory created
✔ Dependencies installed
✔ .env file created
✔ Payload project successfully created

  ★ Launch Application:

    - cd ./payload-cms
    - yarn dev

  ★ Documentation:

    - Getting Started: https://payloadcms.com/docs/getting-started/what-is-payload
    - Configuration: https://payloadcms.com/docs/configuration/overview


npm notice 
npm notice New minor version of npm available! 9.3.1 -> 9.4.1
npm notice Changelog: https://github.com/npm/cli/releases/tag/v9.4.1
npm notice Run npm install -g npm@9.4.1 to update!
npm notice 
/home/node/app # cd ./payload-cms
/home/node/app/trnds-cms # yarn dev
yarn run v1.22.19
$ cross-env PAYLOAD_CONFIG_PATH=src/payload.config.ts nodemon
[nodemon] 2.0.20
[nodemon] to restart at any time, enter `rs`
[nodemon] watching path(s): *.*
[nodemon] watching extensions: ts
[nodemon] starting `ts-node src/server.ts`
[nodemon] app crashed - waiting for file changes before starting...

log using: ts-node with npx

/home/node/app/payload-cms # npx ts-node ./src/server.ts
Illegal instruction

Log using: ts-node without npx

/home/node/app/payload-cms # ts-node ./src/server.ts
Illegal instruction

src/server.ts

After remove payload.init from server.ts the project starts. Which makes me think that the error could be related to the payload npm package. 🤔

import express from 'express';
import payload from 'payload';

require('dotenv').config();
const app = express();

// Redirect root to Admin panel
app.get('/', (_, res) => {
  res.redirect('/admin');
});

const start = async () => {
  // Initialize Payload
  // await payload.init({
  //   secret: process.env.PAYLOAD_SECRET,
  //   mongoURL: process.env.MONGODB_URI,
  //   express: app,
  //   onInit: async () => {
  //     payload.logger.info(`Payload Admin URL: ${payload.getAdminURL()}`)
  //   },
  // })

  // Add your own express routes here

  app.listen(3000);
}

start();


  • discord user avatar
    jmikrut
    Payload Team
    9 months ago

    OK. this is then likely not an issue with Payload and something that you should research regarding your Node 18 Docker image. I bet it has something to do with one of Payload's dependencies. Can you attempt to use another Docker image?

    I will convert this to a discussion as there is likely nothing that Payload can be done to fix this, although I'm happy to continue to help!

  • discord user avatar
    jmikrut
    Payload Team
    9 months ago

    Hey @mauroencinas — this should be doable. I'd try and start your process manually, outside of nodemon, to see if you can get a better error log. Run ts-node src/server.ts and see what you get. Let us know!

  • default discord avatar
    mauroencinas
    9 months ago

    Hey @mauroencinas — this should be doable. I'd try and start your process manually, outside of nodemon, to see if you can get a better error log. Run ts-node src/server.ts and see what you get. Let us know!

    Thank you very much @jmikrut , you are very kind for your recommendation, I tried to do what you told me, and the result is Illegal Instruction, I tried the command with and without npx

Open the post
Continue the discussion in GitHub
Like what we're doing?
Star us on GitHub!

Star

Connect with the Payload Community on Discord

Discord

online

Can't find what you're looking for?

Get help straight from the Payload team with an Enterprise License.