Deploy on GCP
Hey, i'm deploying my NestJS application on GCP cloud run, using Prisma, but I still have this error :
However, I did what was necessary regarding environment variables, here is my entry point in NestJS :
Does anyone have an idea ?
The user-provided container failed to start and listen on the port defined provided by the PORT=8080 environment variable. Logs for this revision might contain more information.The user-provided container failed to start and listen on the port defined provided by the PORT=8080 environment variable. Logs for this revision might contain more information.However, I did what was necessary regarding environment variables, here is my entry point in NestJS :
import { NestFactory } from '@nestjs/core'
import { AppModule } from './app.module'
import * as dotenv from 'dotenv'
import { BadRequestException, Logger, ValidationPipe } from '@nestjs/common'
import { SwaggerExcludeFilter } from './swagger/swagger-exclude-filter.service'
// eslint-disable-next-line @typescript-eslint/no-var-requires
const cookieParser = require('cookie-parser')
async function bootstrap() {
dotenv.config()
const app = await NestFactory.create(AppModule, { cors: true })
await SwaggerExcludeFilter.setup(app)
app.enableCors({
origin: process.env.URL_FRONT,
methods: 'GET,HEAD,PUT,PATCH,POST,DELETE',
preflightContinue: false,
optionsSuccessStatus: 204,
credentials: true
})
app.useLogger(new Logger())
app.useGlobalPipes(
new ValidationPipe({
whitelist: true,
forbidNonWhitelisted: true,
transform: true,
disableErrorMessages: false,
exceptionFactory: errors => {
return new BadRequestException(
errors.map(
error =>
`${error.property} errors: ${Object.values(
error.constraints
).join(', ')}`
)
)
}
})
)
app.use(cookieParser())
const PORT = process.env.PORT || 8080
const HOSTNAME = process.env.HOSTNAME || '0.0.0.0'
await app.listen(PORT, HOSTNAME)
}
bootstrap()import { NestFactory } from '@nestjs/core'
import { AppModule } from './app.module'
import * as dotenv from 'dotenv'
import { BadRequestException, Logger, ValidationPipe } from '@nestjs/common'
import { SwaggerExcludeFilter } from './swagger/swagger-exclude-filter.service'
// eslint-disable-next-line @typescript-eslint/no-var-requires
const cookieParser = require('cookie-parser')
async function bootstrap() {
dotenv.config()
const app = await NestFactory.create(AppModule, { cors: true })
await SwaggerExcludeFilter.setup(app)
app.enableCors({
origin: process.env.URL_FRONT,
methods: 'GET,HEAD,PUT,PATCH,POST,DELETE',
preflightContinue: false,
optionsSuccessStatus: 204,
credentials: true
})
app.useLogger(new Logger())
app.useGlobalPipes(
new ValidationPipe({
whitelist: true,
forbidNonWhitelisted: true,
transform: true,
disableErrorMessages: false,
exceptionFactory: errors => {
return new BadRequestException(
errors.map(
error =>
`${error.property} errors: ${Object.values(
error.constraints
).join(', ')}`
)
)
}
})
)
app.use(cookieParser())
const PORT = process.env.PORT || 8080
const HOSTNAME = process.env.HOSTNAME || '0.0.0.0'
await app.listen(PORT, HOSTNAME)
}
bootstrap()Does anyone have an idea ?