Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ services:
env_file:
- ./.env
volumes:
- $PWD/libs/prisma-service/prisma/data/credebl-master-table.json:/app/libs/prisma-service/prisma/data/credebl-master-table.json
- $PWD/libs/prisma-service/prisma/data/credebl-master-table/credebl-master-table.json:/app/libs/prisma-service/prisma/data/credebl-master-table/credebl-master-table.json
api-gateway:
depends_on:
- nats # Use depends_on instead of needs
Expand Down Expand Up @@ -68,6 +68,8 @@ services:
image: ghcr.io/credebl/issuance:latest
env_file:
- ./.env
volumes:
- $PWD/apps/uploadedFiles/exports:/app/uploadedFiles/exports
Comment on lines +71 to +72
Copy link

@coderabbitai coderabbitai bot Nov 28, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Description: Verify issuance service configuration for the exports directory

# Check if the uploadedFiles/exports directory exists in the repo
if [ -d "apps/uploadedFiles/exports" ]; then
  echo "✓ Directory exists at apps/uploadedFiles/exports"
  ls -la apps/uploadedFiles/exports
else
  echo "ℹ Directory does not yet exist at apps/uploadedFiles/exports (may be created at runtime)"
fi

# Search for references to uploadedFiles/exports in issuance service code
echo -e "\n=== Checking for exports directory references in issuance service ==="
rg -i 'uploadedFiles.*exports|exports.*directory' apps/issuance --type=ts --type=js -C 2 2>/dev/null || echo "No matches found in issuance service"

# Search for related file upload/export handling patterns
echo -e "\n=== Checking for file export patterns in issuance service ==="
rg -i 'export.*file|bulk.*issuance' apps/issuance --type=ts --type=js -C 1 2>/dev/null | head -15

Repository: credebl/platform

Length of output: 1810


🏁 Script executed:

#!/bin/bash

# Find and examine the createFile function
echo "=== Looking for createFile function definition ==="
rg -n 'function createFile|export.*createFile|const createFile' apps/issuance --type=ts --type=js -A 10 | head -30

# Check for any mkdir or directory creation in issuance service
echo -e "\n=== Checking for directory creation logic in issuance service ==="
rg -n 'mkdir|createDir|ensureDir|existsSync|makedirs' apps/issuance --type=ts --type=js -B 2 -A 2

# Look at the full docker-compose.yml context
echo -e "\n=== Checking docker-compose.yml for issuance service context ==="
cat -n docker-compose.yml | sed -n '60,85p'

# Check if there's a Dockerfile or entrypoint script for issuance
echo -e "\n=== Looking for Dockerfile or initialization scripts ==="
find apps/issuance -name "Dockerfile*" -o -name "entrypoint*" -o -name "*.sh" | head -10

Repository: credebl/platform

Length of output: 1038


🏁 Script executed:

#!/bin/bash

# Get the full issuance service configuration from docker-compose
echo "=== Full issuance service in docker-compose.yml ==="
rg -n 'issuance:' docker-compose.yml -A 20

# Search for createFile across entire repository
echo -e "\n=== Searching for createFile function across repo ==="
rg -n 'export.*createFile|function createFile|const createFile' . --type=ts --type=js | head -20

# Search more broadly for file creation utilities
echo -e "\n=== Searching for file utility functions ==="
rg -n 'createFile|writeFile|ensureFile' . --type=ts --type=js --glob='**/util*' --glob='**/lib*' --glob='**/helper*' -l

# Check docker-compose structure - get lines around the volume mount mentioned
echo -e "\n=== Checking docker-compose.yml structure around uploads/exports ==="
rg -n 'uploadedFiles.*exports|/app/uploadedFiles/exports' docker-compose.yml -B 5 -A 2

Repository: credebl/platform

Length of output: 1054


🏁 Script executed:

#!/bin/bash

# Read the createFile function implementation
echo "=== Reading createFile function from file-operation.helper.ts ==="
cat -n apps/api-gateway/src/helper-files/file-operation.helper.ts

# Also check if there are any imports or usages related to mkdir
echo -e "\n=== Checking for mkdir or fs-extra usage in file-operation.helper.ts ==="
rg -n 'mkdir|ensureDir|mkdirSync|promises\.mkdir' apps/api-gateway/src/helper-files/file-operation.helper.ts -B 2 -A 2

Repository: credebl/platform

Length of output: 1614


🏁 Script executed:

#!/bin/bash

# Search for any .gitkeep or placeholder files
echo "=== Looking for uploadedFiles directory structure ==="
find . -path "*/uploadedFiles*" -type f -o -path "*/uploadedFiles*" -type d 2>/dev/null | head -20

# Check if there's a Dockerfile for issuance service that sets working directory
echo -e "\n=== Searching for Dockerfile or build configuration ==="
find . -name "Dockerfile*" -o -name ".dockerignore" | xargs grep -l "issuance\|WORKDIR" 2>/dev/null | head -10

# Verify the actual paths used in issuance service
echo -e "\n=== Checking all uploadedFiles references in issuance service ==="
rg -n 'uploadedFiles' apps/issuance --type=ts --type=js -B 2 -A 2

# Check if process.cwd() is being used elsewhere to understand container context
echo -e "\n=== Checking process.cwd() usage ==="
rg -n 'process\.cwd()' apps/issuance --type=ts --type=js -C 1 | head -20

Repository: credebl/platform

Length of output: 1906


🏁 Script executed:

#!/bin/bash

# Read the Dockerfile for issuance service
echo "=== Dockerfile.issuance ==="
cat -n Dockerfiles/Dockerfile.issuance

# Also check for any docker-compose overrides or additional config
echo -e "\n=== Checking if there are docker-compose overrides or extended configs ==="
find . -name "docker-compose*.yml" -o -name "docker-compose*.yaml" | head -10

Repository: credebl/platform

Length of output: 1964


🏁 Script executed:

#!/bin/bash

# Get the full docker-compose.yml to see actual structure
echo "=== Full docker-compose.yml issuance service section ==="
rg -n 'issuance:' docker-compose.yml -A 30

# Check for any volume definitions at service or compose level
echo -e "\n=== Checking volumes section in docker-compose.yml ==="
rg -n 'volumes:' docker-compose.yml -A 10

# Double-check current line 71-72 context from the file
echo -e "\n=== Exact lines 71-72 from docker-compose.yml ==="
sed -n '69,75p' docker-compose.yml

Repository: credebl/platform

Length of output: 2883


🏁 Script executed:

#!/bin/bash

# Check Node.js version to confirm mkdirSync behavior
echo "=== Confirming mkdirSync recursive flag requirement ==="
grep -i "node:" Dockerfiles/Dockerfile.issuance | head -1

# Search for any recent updates to the file-operation helper (in case recursive flag was added)
echo -e "\n=== Double-checking current createFile implementation ==="
rg -n 'mkdirSync' apps/api-gateway/src/helper-files/file-operation.helper.ts

# Check if there's a .gitkeep in uploadedFiles or any placeholder
echo -e "\n=== Looking for any gitkeep or init files ==="
find . -name ".gitkeep" -path "*uploadedFiles*" -o -name "README*" -path "*uploadedFiles*" 2>/dev/null

Repository: credebl/platform

Length of output: 279


Based on my comprehensive verification, I've identified several critical issues with the proposed volume mount configuration. Here's the rewritten review comment:


Fix critical directory creation bug and ensure host directory exists before deployment.

The proposed volume mount ($PWD/apps/uploadedFiles/exports:/app/uploadedFiles/exports) references a path that will fail at runtime due to a bug in the createFile utility. The function at apps/api-gateway/src/helper-files/file-operation.helper.ts:13 uses fs.mkdirSync(path) without the { recursive: true } flag, which will fail when creating nested directories like uploadedFiles/exports.

Additionally:

  • The host directory apps/uploadedFiles/exports does not exist in the repository (no .gitkeep or placeholder), and Docker volume mounts do not auto-create host directories
  • The Dockerfile does not initialize this directory (line 42 that would copy it is commented out)
  • File permissions and ownership are not specified in the volume mount configuration

Required fixes:

  1. Update createFile in apps/api-gateway/src/helper-files/file-operation.helper.ts to use fs.mkdirSync(path, { recursive: true })
  2. Add .gitkeep to apps/uploadedFiles/exports or ensure directory creation during deployment
  3. Consider specifying permissions via uid:gid in the docker-compose volume mount if needed
🤖 Prompt for AI Agents
In docker-compose.yml around lines 71-72, the volume mount
$PWD/apps/uploadedFiles/exports:/app/uploadedFiles/exports will fail because the
host path may not exist and your createFile utility in
apps/api-gateway/src/helper-files/file-operation.helper.ts (around line 13) uses
fs.mkdirSync(path) without recursive=true; update that function to call
fs.mkdirSync(path, { recursive: true }) so nested dirs are created, add a
placeholder (e.g., .gitkeep) or ensure the directory apps/uploadedFiles/exports
is created prior to Docker up (CI/build script or repo) so the host path exists,
and if needed adjust the docker-compose volume to include explicit uid:gid
permissions or set proper chown in the container startup to avoid permission
issues.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@KambleSahil3 Please add the folder

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems like the humans are having a chat. I'll hop back into my burrow for now. If you need me again, just tag @coderabbitai in a new comment, and I'll come hopping out!

ledger:
depends_on:
- nats # Use depends_on instead of needs
Expand Down Expand Up @@ -178,4 +180,4 @@ services:

volumes:
cache:
driver: local
driver: local