Skip to content

Errors when working with symbolic links in Linux #544

@warcayac

Description

@warcayac

What version of Elysia.JS is running?

1.0.31+e25675121

What platform is your computer?

Linux 6.8.1-zen1-1-zen x86_64 unknown

What steps can reproduce the bug?

I reuse code in my Bun/ElysiaJS projects by using symbolic links, only when my project is finished then I convert those symbolic links into real copies. I use symbolic links (generated by ln command) instead of "bun link" because bun link doesn't work as expected, links are not recognized for the project or generate errors in runtime, so I chose to create my own scripts. I've been working without problems until recently, after updating bun and elysia package I'm getting errors:

➜ bun run dev
$ NODE_ENV=development bun --env-file=.env run --watch src/index.ts
5681 |           this.dependencies[name] = [];
5682 |         const current = seed !== undefined ? checksum(name + JSON.stringify(seed)) : 0;
5683 |         if (!this.dependencies[name].some(({ checksum: checksum2 }) => current === checksum2))
5684 |           this.extender.macros = this.extender.macros.concat(plugin.extender.macros);
5685 |       } else {
5686 |         this.extender.macros = this.extender.macros.concat(plugin.extender.macros);
                                                                  ^
TypeError: undefined is not an object (evaluating 'plugin.extender.macros')
      at _use (/home/warcayac/DataDisk/Projects/Programming/HtmX/airasoul/demodemo/node_modules/elysia/dist/bun/index.js:5686:60)
      at /home/warcayac/DataDisk/Projects/Programming/HtmX/airasoul/demodemo/src/index.ts:10:1
5681 |           this.dependencies[name] = [];
5682 |         const current = seed !== undefined ? checksum(name + JSON.stringify(seed)) : 0;
5683 |         if (!this.dependencies[name].some(({ checksum: checksum2 }) => current === checksum2))
5684 |           this.extender.macros = this.extender.macros.concat(plugin.extender.macros);
5685 |       } else {
5686 |         this.extender.macros = this.extender.macros.concat(plugin.extender.macros);
                                                                  ^
TypeError: undefined is not an object (evaluating 'plugin.extender.macros')
      at _use (/home/warcayac/DataDisk/Projects/Programming/HtmX/airasoul/demodemo/node_modules/elysia/dist/bun/index.js:5686:60)
      at /home/warcayac/DataDisk/Projects/Programming/HtmX/airasoul/demodemo/src/index.ts:10:1
^C

If I convert my symbolic links into real copies then there's no errors:

➜ bun_link --convert
✔ Converting symbolic links to real directories...

➜ bun run dev       
$ NODE_ENV=development bun --env-file=.env run --watch src/index.ts
🦊 Elysia is running at localhost:3001
^C

I don't know if this is a problem with Bun or Elysia or both.

What is the expected behavior?

Running server with no errors

What do you see instead?

Error messages described above

Additional information

Versions of installed packages from my recent project before updating:

➜ bun pm ls  
├── @elysiajs/[email protected]
├── @elysiajs/[email protected]
├── @elysiajs/[email protected]
├── @types/[email protected]
├── [email protected]
└── [email protected]

Versions of packages after updating:

➜ bun pm ls  
├── @elysiajs/[email protected]
├── @types/[email protected]
├── [email protected]
└── [email protected]

Here some snippets from a sample project:

index.ts

import Elysia from "elysia";
import cors from "@elysiajs/cors";

import { httpResponse } from "./@warcayac/const-elysia";
import wlogger from "./@warcayac/wlogger";


export const app = new Elysia();

app
  .use(cors({methods: '*'}))
  .use(wlogger(true))
  .get('/', () => "Hello Elysia")
  .all('*', () => httpResponse[404]('Path name not found'))
  .listen(
    process.env.PORT || 3001,
    () => console.log(`🦊 Elysia is running at ${app.server?.hostname}:${app.server?.port}`)
  )
;

@warcayac/const-elysia and @warcayac/wlogger are directories (symbolic links) in my project.

package.json

{
  "name": "demodemo",
  "version": "1.0.50",
  "module": "src/index.js",
  "dependencies": {
    "@elysiajs/cors": "^1.0.0",
    "ansis": "^2.3.0",
    "elysia": "latest"
  },
  "scripts": {
    "test": "NODE_ENV=test bun test ./test/**.test.ts",
    "dev": "NODE_ENV=development bun --env-file=.env run --watch src/index.ts",
    "start": "NODE_ENV=production bun --env-file=.env run src/index.ts"
  },
  "devDependencies": {
    "@types/bun": "^1.0.8"
  }
}

tsconfig.json

{
  "compilerOptions": {
    /* Language and Environment */
    "target": "ES2022",
    "lib": [],
    "moduleDetection": "force",

    /* Modules */
    "module": "ESNext",
    "moduleResolution": "Bundler",
    "resolveJsonModule": true,
    "allowImportingTsExtensions": true,

    /* JavaScript Support */
    "allowJs": true,

    /* Emit */
    "noEmit": true,
    "declaration": true,

    /* Interop Constraints */
    "isolatedModules": true,
    "allowSyntheticDefaultImports": true,
    "esModuleInterop": true,
    "forceConsistentCasingInFileNames": true,

    /* Type Checking */
    "strict": true,
    "noUncheckedIndexedAccess": true,

    /* Completeness */
    "skipLibCheck": true
  },
  "exclude": ["node_modules"]
}

with Elysia v1.0.3 it has become worse with extensively long error messages.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions