Files
lcbp3/docs/deployment-fixes-2026-03-20.md
T
admin 11984bfa29
CI Pipeline / build (push) Failing after 12m41s
Build and Deploy / deploy (push) Failing after 2m44s
260322:1648 Correct Coresspondence / Doing RFA / Correct CI
2026-03-22 16:48:12 +07:00

152 lines
3.0 KiB
Markdown

# Deployment Fixes Summary - 2026-03-20
## 🚨 Issues Encountered
### Backend Build Failures
1. **Missing `ms` package**
- Error: `Cannot find module 'ms' or its corresponding type declarations`
- Impact: Auth module couldn't build
2. **Missing `CACHE_MANAGER` dependency**
- Error: `Nest can't resolve dependencies of the UserService`
- Impact: UserModule and AuthModule failed to start
3. **Missing `UuidResolverService`**
- Error: `Nest can't resolve dependencies of the UserService`
- Impact: UUID resolution failed across modules
### Frontend Docker Build Failures
1. **Next.js standalone build with pnpm**
- Error: `ENOENT: no such file or directory` creating standalone node_modules
- Impact: Docker build failed
---
## 🔧 Solutions Implemented
### Backend Fixes
#### 1. Add Missing Dependencies
```json
// package.json
{
"dependencies": {
"ms": "^2.1.3"
},
"devDependencies": {
"@types/ms": "^2.1.0"
}
}
```
#### 2. Global Cache Configuration
```typescript
// app.module.ts
import { CacheModule } from '@nestjs/cache-manager';
@Module({
imports: [
// Global cache for all modules
CacheModule.register({
isGlobal: true,
ttl: 300, // 5 minutes
}),
// ... other modules
],
})
```
#### 3. CommonModule Import
```typescript
// app.module.ts
import { CommonModule } from './common/common.module';
@Module({
imports: [
CommonModule, // Initialize global services
// ... other modules
],
})
```
### Frontend Docker Fixes
#### 1. Disable Standalone Mode
```javascript
// next.config.mjs
const nextConfig = {
// TEMPORARILY DISABLED: pnpm standalone build issues
// output: "standalone",
};
```
#### 2. Update Dockerfile
```dockerfile
# Copy full app instead of standalone
COPY --from=build --chown=nextjs:nextjs /w/frontend ./
COPY --from=build --chown=nextjs:nextjs /w/frontend/node_modules ./node_modules
# Use pnpm start instead of node server.js
CMD ["pnpm", "start"]
```
---
## 📊 Impact Assessment
### Backend
- ✅ All dependency injection issues resolved
- ✅ Cache manager available globally
- ✅ UUID resolver service accessible
- ✅ Build time: ~21s (successful)
### Frontend
- ✅ Docker build successful
- ⚠️ Image size increased (no standalone optimization)
- ✅ Build time: ~51s (successful)
---
## 🔄 Future Improvements
### Backend
1. **Redis Cache Integration**
- Replace in-memory cache with Redis store
- Resolve `cache-manager-redis-store` TypeScript issues
- Enable distributed caching
### Frontend
1. **Standalone Build Recovery**
- Fix pnpm symlink compatibility
- Re-enable `output: "standalone"`
- Optimize Docker image size
---
## ✅ Verification Checklist
- [x] Backend builds without errors
- [x] Backend starts successfully
- [x] All modules can inject dependencies
- [x] Frontend builds without errors
- [x] Frontend Docker build succeeds
- [x] No TypeScript errors
- [x] No missing dependencies
---
**Status**: ✅ DEPLOYMENT READY
**Updated**: 2026-03-20
**Next Review**: After Redis cache integration