-
Notifications
You must be signed in to change notification settings - Fork 671
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How to upgrade to 4.x ? #360
Comments
Let me know if you have encounter any issues :) |
Great, thanks! import serverlessExpress from '@vendia/serverless-express'
import app from 'src/app'
import configureApp from 'src/configureApp'
// global variable server to keep hot in lambda
// server is set at the first call and reused then
let server
export default async (event, context) => {
if (server) {
return serverlessExpress.proxy(server, event, context, 'PROMISE').promise
}
console.log('Server does not exist')
try {
// init dbs connexion, middleware and other stuff
await configureApp(app)
} catch (e) {
console.error(e)
}
// other initialization
server = serverlessExpress.createServer(app)
return serverlessExpress.proxy(server, event, context, 'PROMISE').promise
} It looks like it's a bit more complicated now that we can't init the server and pass |
You should be able to do something like this #351 (comment) |
Ahh good point. Originally this was using Winston and would only log when |
I've pushed a patch that at least doesn't log debug for production builds. Will get something better in soon to allow setting log.level without needing to specify the other log methods |
# [4.2.0](v4.1.3...v4.2.0) (2021-02-08) ### Features * add logSettings to override log level and default log level to error ([a0e8bdb](a0e8bdb)), closes [#360](#360)
🎉 This issue has been resolved in version 4.2.0 🎉 The release is available on: Your semantic-release bot 📦🚀 |
Thanks, finally used that snippet and it worked as expected! import serverlessExpress from '@vendia/serverless-express'
import app from 'src/app'
import configureApp from 'src/configureApp'
// global variable server to keep hot in lambda
// server is set at the first call and reused then
let server
export default async (event, context) => {
if (server) {
return server(event, context)
}
console.log('Server does not exist')
try {
// init dbs connexion, middleware and other stuff
await configureApp(app)
} catch (e) {
console.error(e)
}
// other initialization
server = serverlessExpress({ app })
return server(event, context)
} |
@j0k3r - Could you please share the a code snippet for |
@sudhirjena Here is a short version: import app from './app'
app.set('isProduction', process.env.NODE_ENV === 'prod')
app.set('json spaces', 2)
export default (application) => {
application.set('app:ready', true)
return application
} And import express from 'express'
process.env.TZ = 'Europe/Paris'
export default express() |
# [4.2.0](CodeGenieApp/serverless-express@v4.1.3...v4.2.0) (2021-02-08) ### Features * add logSettings to override log level and default log level to error ([a0e8bdb](CodeGenieApp/serverless-express@a0e8bdb)), closes [#360](CodeGenieApp/serverless-express#360)
As the 4.x is a major release and no
UPGRADE.md
file exist in the repo, I was wondering how should we upgrade from the 3.4.0 version ?The text was updated successfully, but these errors were encountered: