Temporal Client Fails to Connect Inside Docker Container (Node.js/Bun)

I’ve been stuck on a frustrating issue for a few days and I’m hoping someone in the community can point me in the right direction. My Temporal worker/client runs perfectly on my local machine, but as soon as I containerize it with Docker, it fails to connect to the Temporal Cloud endpoint.

I’ve tried numerous solutions related to networking, DNS, and SSL certificates inside the container, but nothing has worked.

  • Temporal Server Version: Temporal Cloud
  • Temporal SDK Versions:
    • @temporalio/client: v1.12.1
    • @temporalio/worker: v1.12.1
    • @temporalio/activity: v1.12.1
    • @temporalio/common: v1.12.1
    • @temporalio/workflow: v1.12.1
{
  "timestamp": 1753201483496,
  "level": "ERROR",
  "message": "undefined undefined: undefined",
  "code": "UNKNOWN",
  "request": {
    "method": "POST",
    "path": "/trigger",
    "query": {}
  },
  "stack": "Error: undefined undefined: undefined\n    at callErrorFromStatus (/app/node_modules/@grpc/grpc-js/build/src/call.js:32:23)\n    at onReceiveStatus (/app/node_modules/@grpc/grpc-js/build/src/client.js:193:56)\n    at <anonymous> (/app/node_modules/@grpc/grpc-js/build/src/call-interface.js:78:35)\n    at onReceiveStatus (/app/node_modules/@temporalio/client/lib/grpc-retry.js:161:25)\n    at <anonymous> (/app/node_modules/@temporalio/client/lib/grpc-retry.js:164:17)\n    at onReceiveStatus (/app/node_modules/@grpc/grpc-js/build/src/call-interface.js:73:23)\n    at onReceiveStatus (/app/node_modules/@grpc/grpc-js/build/src/client-interceptors.js:361:141)\n    at onReceiveStatus (/app/node_modules/@grpc/grpc-js/build/src/client-interceptors.js:324:181)\n    at <anonymous> (/app/node_modules/@grpc/grpc-js/build/src/resolving-call.js:135:78)\n    at processTicksAndRejections (native:7:39)\nfor call at\n    at makeUnaryRequest (/app/node_modules/@grpc/grpc-js/build/src/client.js:161:32)\n    at <anonymous> (/app/node_modules/@temporalio/client/lib/connection.js:278:33)\n    at rpcCall (/app/node_modules/protobufjs/src/rpc/service.js:94:21)\n    at executor (/app/node_modules/@protobufjs/aspromise/index.js:44:16)\n    at new Promise (native:1:11)\n    at asPromise (/app/node_modules/@protobufjs/aspromise/index.js:28:16)\n    at getSystemInfo (file:///app/dist/index.js:4:22)\n    at run (node:async_hooks:62:22)\n    at withDeadline (/app/node_modules/@temporalio/client/lib/connection.js:303:46)\n    at withDeadline (/app/node_modules/@temporalio/client/lib/connection.js:301:24)" 

I am using a multi-stage Dockerfile with the official Bun image:

# ~~~~~~~~~~~~~~ STAGE 1: The Builder ~~~~~~~~~~~~~~
FROM node:18-alpine AS builder

RUN apk add --no-cache curl bash
RUN curl -fsSL https://bun.sh/install | bash
ENV PATH="/root/.bun/bin:${PATH}"

WORKDIR /app

COPY package.json bun.lockb ./
RUN bun install --frozen-lockfile

COPY . .
RUN bun run build

# ~~~~~~~~~~~~~~ STAGE 2: The Runner ~~~~~~~~~~~~~~
FROM oven/bun:1-alpine AS runner

RUN apk add --no-cache ca-certificates

WORKDIR /app

COPY --from=builder /app/dist ./dist
COPY --from=builder /app/node_modules ./node_modules
COPY --from=builder /app/package.json ./package.json
COPY --from=builder /app/bun.lockb ./bun.lockb

EXPOSE 3001

CMD ["bun", "run", "dist/index.js"]

I would be incredibly grateful for any insights or suggestions. Thank you!

profile picture

Hi,

not sure if this can be the issue Core application - TypeScript SDK | Temporal Platform Documentation

Have you tried with a non-alpine distribution?

Antonio

Hey Antonio,

Yeah, I gave it a shot but was still getting the same error. I ended up switching from Bun to Node.js, and that did the trick.

Thank you!

For anyone else coming across this in the future, fix seems to be patching the protobufjs library. Hopefully the Bun team can get this resolved. GitHub · Where software is built