Skip to content

fix(kubernetes): fix HTTPS module bundling issues in production#1141

Merged
andypf merged 1 commit intomainfrom
andypf-fix-k8s
Aug 27, 2025
Merged

fix(kubernetes): fix HTTPS module bundling issues in production#1141
andypf merged 1 commit intomainfrom
andypf-fix-k8s

Conversation

@andypf
Copy link
Copy Markdown
Collaborator

@andypf andypf commented Aug 25, 2025

Problem

Applications using this client were throwing errors in production environments due to the https module being incorrectly processed during the bundling process. This caused runtime failures when consuming applications tried to create HTTPS agents for SSL certificate handling.

Error symptoms:

  • https.Agent is not a constructor errors in production for consuming applications
  • SSL ignore functionality not working in bundled environments
  • Runtime failures when consuming applications make HTTPS requests with ignoreSsl: true

Root Cause

The https module (Node.js built-in) was being processed by the bundler instead of being treated as an external dependency. This caused issues because:

  1. Built-in Node.js modules should not be bundled into the client library
  2. The bundler was trying to include/transform the https module incorrectly
  3. Consuming applications couldn't access the native https module functionality when using the bundled client

Solution

Added https (and other Node.js built-ins) to the external configuration in vite.config.ts:

export default {
  build: {
    rollupOptions: {
      external: [
        "https"
      ],
    },
  },
}

Testing Instructions

  1. pnpm i
  2. pnpm TASK

Checklist

  • I have performed a self-review of my code.
  • I have commented my code, particularly in hard-to-understand areas.
  • I have added tests that prove my fix is effective or that my feature works.
  • New and existing unit tests pass locally with my changes.
  • I have made corresponding changes to the documentation (if applicable).
  • My changes generate no new warnings or errors.
  • I have created a changeset for my changes.

PR Manifesto

Review the PR Manifesto for best practises.

@andypf andypf requested a review from a team as a code owner August 25, 2025 14:31
@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented Aug 25, 2025

⚠️ No Changeset found

Latest commit: 1c8adc8

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

Comment thread packages/k8s-client/src/request.ts Dismissed
Comment thread packages/k8s-client/src/request.ts
Comment thread packages/k8s-client/src/request.ts
Copy link
Copy Markdown
Contributor

@hgw77 hgw77 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

to disable ssl verify in development is fine for me 👍

@andypf andypf merged commit eac44a9 into main Aug 27, 2025
21 checks passed
@andypf andypf deleted the andypf-fix-k8s branch August 27, 2025 12:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants