Skip to content

MissingFile Error in Docker with tempFileDir set #14437

@cbratschi

Description

@cbratschi

Describe the Bug

The Payload configuration is.

    upload: {
        //use temp file storage (don't keep buffers in memory)
        useTempFiles: true,

        //Note: /app/tmp in Docker
        tempFileDir: './tmp',

        //debug
        debug: true
    },

The Dockerfile was extended to create /app/tmp otherwise uploads fail with "ERROR: EACCES: permission denied":

COPY --from=builder --chown=nextjs:nodejs /app/.next/standalone ./
COPY --from=builder --chown=nextjs:nodejs /app/.next/static ./.next/static

RUN mkdir tmp
RUN chown nextjs:nodejs tmp
#RUN chmod a+rwX tmp

USER nextjs

No debug statements are shown in the logs, it just fails with:

2025-10-31T22:17:23.819511479Z [22:17:23] ERROR: Es wurden keine Dateien hochgeladen.
2025-10-31T22:17:23.819548815Z     err: {
2025-10-31T22:17:23.819552551Z       "type": "l",
2025-10-31T22:17:23.819556286Z       "message": "Es wurden keine Dateien hochgeladen.",
2025-10-31T22:17:23.819559691Z       "stack":
2025-10-31T22:17:23.819562876Z           l: Es wurden keine Dateien hochgeladen.
2025-10-31T22:17:23.819566071Z               at dm (/app/.next/server/chunks/6707.js:178:38400)
2025-10-31T22:17:23.819569105Z               at M (/app/.next/server/chunks/6707.js:27:68750)
2025-10-31T22:17:23.819572630Z               at process.processTicksAndRejections (node:internal/process/task_queues:105:5)
2025-10-31T22:17:23.819575745Z               at async aM (/app/.next/server/chunks/6707.js:25:72087)
2025-10-31T22:17:23.819578931Z               at async p (/app/.next/server/chunks/4669.js:1:12112)
2025-10-31T22:17:23.819582045Z               at async /app/.next/server/chunks/4669.js:1:14752
2025-10-31T22:17:23.819584869Z               at async rN.do (/app/node_modules/next/dist/compiled/next-server/app-route.runtime.prod.js:5:21042)
2025-10-31T22:17:23.819588044Z               at async rN.handle (/app/node_modules/next/dist/compiled/next-server/app-route.runtime.prod.js:5:25860)
2025-10-31T22:17:23.819591429Z               at async k (/app/.next/server/app/(payload)/cms/api/[...slug]/route.js:1:4643)
2025-10-31T22:17:23.819594434Z               at async rN.handleResponse (/app/node_modules/next/dist/compiled/next-server/app-route.runtime.prod.js:1:105568)
2025-10-31T22:17:23.819597849Z       "data": null,
2025-10-31T22:17:23.819601073Z       "isOperational": true,
2025-10-31T22:17:23.819604088Z       "isPublic": false,
2025-10-31T22:17:23.819606852Z       "status": 400,
2025-10-31T22:17:23.819609586Z       "name": "l"
2025-10-31T22:17:23.819612891Z     }

The exception text is from the MissingFile error.

In some rare cases the upload succeeds and the log output is there. I guess there are some problems with file I/O and some exceptions are not caught. It runs fine in a local build. Debugging in Docker is not easy because Payload gets bundled and cannot be monkey patched.

Link to the code that reproduces this issue

https://github.com/cbratschi/payload

Reproduction Steps

See above.

Which area(s) are affected? (Select all that apply)

area: core

Environment Info

Binaries:
  Node: 24.5.0
  npm: 11.6.1
  Yarn: N/A
  pnpm: N/A
Relevant Packages:
  payload: 3.60.0
Operating System:
  Platform: darwin
  Arch: arm64
  Version: Darwin Kernel Version 24.6.0: Mon Jul 14 11:30:55 PDT 2025; root:xnu-11417.140.69~1/RELEASE_ARM64_T6031
  Available memory (MB): 65536
  Available CPU cores: 16

Metadata

Metadata

Assignees

No one assigned

    Labels

    status: needs-triagePossible bug which hasn't been reproduced yet

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions