Skip to content

[BUG] server/index.js has leftover merge conflict artifacts causing a SyntaxError (backend cannot start) #515

@Anexus5919

Description

@Anexus5919

Summary

server/index.js is the backend entry point (server/package.json sets "main": "index.js" and "start": "node index.js"). It currently contains leftover merge conflict artifacts, so the file is not valid JavaScript and the backend cannot start.

Details

The problem is a block at lines 14 to 18:

  1. Line 14 is a bare branch name feature/login-auth sitting as code. It evaluates as feature / login - auth and throws ReferenceError: feature is not defined at runtime.
  2. Lines 17 and 18 redeclare const fs and const path, which are already declared at the top of the file (lines 8 and 9). A const redeclaration is a hard parse error.

The same block also repeats app.use(cors()) and app.use(express.json()), which duplicate the security middleware configured later (lines 58 to 63: helmet(), a CORS policy restricted by CLIENT_URL, and express.json({ limit: '2mb' })). The plain app.use(cors()) also re-opens CORS to all origins before the restricted policy runs.

Steps to reproduce

  1. On main, run node --check server/index.js.
  2. Observe:
server/index.js:17
const fs = require('fs');
      ^
SyntaxError: Identifier 'fs' has already been declared

Starting the backend (npm start inside server/) fails the same way.

Expected

server/index.js parses as valid JavaScript and the backend starts.

Actual

node --check fails with SyntaxError: Identifier 'fs' has already been declared. The backend cannot start.

Suggested fix

Remove the leftover merge block (lines 14 to 18): the feature/login-auth line, the duplicate const fs and const path, and the duplicate app.use(cors()) and app.use(express.json()). Keep the existing top level requires and the restricted security middleware block already present below.

Notes

This is one part of a recent bad merge. server/package.json is also currently invalid JSON, which blocks npm install inside server/; that is a separate report. Both are required for the backend to install and boot.

I would like to work on this issue.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions