Using Bun (instead of npm): SSL error when auth?

I was testing out bun instead of npm or node and I couldn’t get the same behavior: what I mean by that is that running the app with bun I was not able authenticate, but I was with node (see below example)

https://app.dashcam.io/replay/64ff8108923289006233ea16

Any idea what might be causing that?

Hi there, thanks for posting your question. Bun seems to get more and more attention, looks promising. I was able to fix the problem by adding an additional layer with Greenlock.

install the package:

npm install --save greenlock-express@v4

In the index.js export the app:

const PORT = process.env.PORT || 8000;
if (require.main === module) {
  app.listen(PORT, () => {
    console.log(`Listening to requests on port http://localhost:${PORT}`);
  });
}

module.exports = app;

Created additional server.js file:

"use strict";

const app = require("./index.js");

require("greenlock-express")
    .init({
        packageRoot: __dirname,
        configDir: "./greenlock.d",

        // contact for security and critical bug notices
        maintainerEmail: "youremail@text.com",

        // whether or not to run at cloudscale
        cluster: false
    })
    // Serves on 80 and 443
    // Get's SSL certificates magically!
    .serve(app);

and added the config folder greenlock.d with config.json file:

{ "sites": [{ "subject": "http://localhost:8000", "altnames": ["http://localhost:8000"] }] }

To run the project with bun type in the terminal:

bun start -- --staging

Let me know if that works for you!

Cheers,
Olga

1 Like

Thanks for replying Olga, gonna try it and let you know!