-
Notifications
You must be signed in to change notification settings - Fork 45
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
Adding package.json warning when using AzureFiles #501
Conversation
src/WorkerChannel.ts
Outdated
delayInMs = 5000; | ||
} | ||
setTimeout(() => { | ||
const path = require('path'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: I would put this "path" import at the top of the file with all the other imports
this.log({ | ||
message: | ||
'package.json is not found at the root of the Function App in Azure Files - cold start for NodeJs can be affected.', | ||
level: LogLevel.Debug, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this be LogLevel.Warning
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's leave it as LogLevel. Debug as we do not want to scary customers with sudden unknown warning.
src/WorkerChannel.ts
Outdated
@@ -167,6 +168,8 @@ export class WorkerChannel implements IWorkerChannel { | |||
err = exception; | |||
} | |||
|
|||
this.logColdStartWarning(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe by putting this in functionLoadRequest
, the log will get written once per function. However, we really only need to log it once per app. With that in mind, I think workerInitRequest
might be a better place
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yeah, you are right. moved to workerInitRequest
On reading function code NodeJs tries to find 'package.json' all the way up to the file system root
In Azure files it causes a delay during cold start as connection to Azure Files is an expensive operation.
We want to add a log to detect the issue.