I get 502 bad gateway after authentication with microsoft on redirect to /onedrive/callback
I run companion from docker image and I use nginx in front of companion, this is my configuration:
services:
companion:
image: transloadit/companion:edge
container_name: uppy_companion
restart: always
ports:
- "3020:3020"
environment:
COMPANION_SECRET: "super-secret"
COMPANION_DOMAIN: "myserver:3021"
COMPANION_PROTOCOL: "https"
COMPANION_DATADIR: "/storage"
COMPANION_GOOGLE_KEY: "your_google_client_id"
COMPANION_GOOGLE_SECRET: ${GOOGLE_SECRET}
COMPANION_ONEDRIVE_DOMAIN_VALIDATION: true
COMPANION_ONEDRIVE_KEY: "xxx"
COMPANION_ONEDRIVE_SECRET: ${ONEDRIVE_SECRET}
COMPANION_CLIENT_ORIGINS: "https://frontend_server:3003"
COMPANION_OAUTH_DOMAIN: "myserver:3021"
volumes:
- ./storage:/storage
I see that in the past this has been an issue, I can’t figure out why it happens.
If this can help as a clue, also in docker logs I get:
uppy_companion | companion: 2025-10-02T11:29:11.503Z [debug] null Generating auth token for provider onedrive. refreshToken: yes
uppy_companion | ::ffff:192.168.64.1 - - [02/Oct/2025:11:29:11 +0000] "GET /onedrive/callback HTTP/1.1" 302 7455 "https://login.microsoftonline.com/" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.0.0 Safari/537.36"
Which comes from /packages/@uppy/companion/src/server/controllers/callback.js file:
logger.debug(
`Generating auth token for provider ${providerName}. refreshToken ${refreshToken ? 'yes' : 'no'}`,
null,
req.id,
)
I suppose req.id should be visible on debug log, when I tried to use version 4.7 it was visible.