Skip to content

Missing Environment Variable Check for FRONTEND_URL #6

@beetle-ai

Description

@beetle-ai

ISSUE_NUMBER: GH-1

Description

The application uses process.env.FRONTEND_URL! without checking if the FRONTEND_URL environment variable is set. This can lead to a crash if the variable is not defined.
File: repositories/chatgptapi/src/app.ts
Line: 36
Severity: high

Current Behavior

The application assumes that process.env.FRONTEND_URL is always defined.

Expected Behavior

The application should check if process.env.FRONTEND_URL is defined and provide a default value or handle the case where it is not set.

Suggested Fix

Add a check for process.env.FRONTEND_URL and provide a default value or handle the error.

Code Context

app.use(cors({
origin: process.env.FRONTEND_URL!,
credentials: true,
}));

Additional Notes

This affects application stability and can lead to unexpected crashes.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions