Why can't I see my console.log statements inside server.js on the logs tab

Hi all, I have an express server running on glitch. Weirdly enough the logs tab only shows the logs inside my app.listen callback. Another weird thing I noticed is suddenly I have 3 projects on my dashboard with the same code - I never created them. Sharing my code here for context. Thank you.

import express from "express";
import multer from "multer";
import axios from "axios";
import fs from "fs";
import { File } from "@web-std/file";
import FormData from "form-data";
import { Blob } from "buffer";
import cors from 'cors';

const upload = multer({ dest: "uploads/" });
const app = express();
const BASE_URL = "https://api.scoptalent.com/api/public";

const client = axios.create({
  baseURL: BASE_URL,
  headers: {
    common: {
      Authorization: "ApiKey", // TEST

const uploadFile = async (file) => {
  const url = "/documents/";
  const formData = new FormData();
  formData.append("file", file, "testfile.pdf");

  const response = await client.post(url, formData);

  return response.data.token;

const postJob = async (applicantObject) => {
  const url = "/applications/";
  const response = await client.post(url, applicantObject);

  return response.data;

app.post("/upload", upload.single("cvUpload"), async (req, res) => {

  try {
    const fileData = fs.readFileSync(req.file.path);

    const tokenOfFile = await uploadFile(fileData);

    const applicantObject = {
      cVtoken: tokenOfFile,
      vacancyId: req.body.vacancyId,
      profile: {
        email: req.body.email,
        firstName: req.body.firstName,
        lastName: req.body.lastName,
        phone: req.body.phone,

    const responseJob = await postJob(applicantObject);

  } catch (error) {
    console.log("Error:", error);
    res.status(500).send("An error occurred.");

const PORT = 4000;
app.listen(PORT, () => {
  console.log(`Server is running on port ${PORT}`);

what are you doing with the PORT = 4000?

Based on the provided code, I can see that you have console.log statements in your server.js file, but they are not appearing in the Glitch logs.
Sometimes, there might be a delay in displaying logs on the Glitch platform.
Try moving the console.log statements to the main thread of execution, This way, they are more likely to be displayed in the logs.

app.post("/upload", upload.single("cvUpload"), async (req, res) => {
  console.log("Console log inside the app.post route handler");
  // Rest of the code...

Use console.error instead of console.log.

app.post("/upload", upload.single("cvUpload"), async (req, res) => {
  try {
    // Your code...
  } catch (error) {
    console.error("Error:", error);
    res.status(500).send("An error occurred.");

To see the detail console logs in the Glitch logs tab.

I hope it help you.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.