Skip to content

Order of server start and handle mounts #62

@chrisrhymes

Description

@chrisrhymes

Describe the bug

I am trying to understand the order of operations in a deploy, as it seems to be out of sync. Is this correct?

  1. Build hook - yarn install, yarn build and copy .next to temp directory
  2. Start the next server
  3. Deploy hook - copies mounts back over .next directory

If correct, this means that the server has started with an old version of the .next directory and it could look for a particularly named js file in .next/server/pages, but once the deploy hook runs and the mount is updated, the js file may not exist anymore or be renamed, and the server returns an error.

Include some logs

Error: Cannot find module '/app/.next/server/pages/[...path].js'

Reproducing

We had a dynamic path pages/[...path]/index.tsx which was renamed pages/[[...path]]/index.tsx. After deploying to platform.sh it was still looking for [...path].js rather than the new [[...path]].js file.

Expected behavior

Mount the directories before starting the server so the server has access to the latest and correct .next directory.

Your environment

type: 'nodejs:14'

build:
  flavor: none

Screenshots

No response

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions