Skip to content

Failed to generate OpenAPI schema of references: fromTypes() when run on docker #319

Description

@seepine

src/index.ts

export const app = new Elysia({})
  .get('/test', 'test')
  .openapi({
    references: fromTypes()
  })
  .listen(3000)

Dockerfile

FROM oven/bun:alpine AS build
WORKDIR /work
COPY package.json bun.lock bunfig.toml tsconfig.json ./
RUN bun install
COPY ./src ./src
ENV NODE_ENV=production
RUN bun build \
  --compile \
  --target bun \
  --minify-whitespace \
  --minify-syntax \
  --outfile app \
  src/index.ts

# Runtime
FROM alpine:3.22
RUN apk add --no-cache libstdc++
WORKDIR /work 
COPY --from=build /work/app app
EXPOSE 3000
ENTRYPOINT ["./app"]

Got warn log when curl http://localhost:3000/openapi

elysia-template-1  | [1] Elysia is running at http://localhost:3000
elysia-template-1  | [@elysiajs/openapi/gen] Failed to generate OpenAPI schema
elysia-template-1  | warn: Couldn't find "src/index.ts" from /work
elysia-template-1  |       at <anonymous> (/$bunfs/root/app:618:13921)
elysia-template-1  |       at toOpenAPISchema (/$bunfs/root/app:414:147423)
elysia-template-1  |       at <anonymous> (/$bunfs/root/app:633:2636)
elysia-template-1  |       at handle (builtin:///$bunfs/root/app:12:47)
elysia-template-1  | 

There will be no warning after removing references: fromTypes() .

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions