Skip to content

Commit bbfc4ab

Browse files
authored
Temporarily remove app startup feature (#596)
In order to get Node 18 support out faster
1 parent 47aa14f commit bbfc4ab

File tree

2 files changed

+17
-35
lines changed

2 files changed

+17
-35
lines changed

src/eventHandlers/WorkerInitHandler.ts

Lines changed: 4 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,9 @@
22
// Licensed under the MIT License.
33

44
import { access, constants } from 'fs';
5-
import { pathExists } from 'fs-extra';
65
import * as path from 'path';
76
import { AzureFunctionsRpcMessages as rpc } from '../../azure-functions-language-worker-protobuf/src/rpc';
8-
import { loadScriptFile } from '../loadScriptFile';
9-
import { ensureErrorType, isError } from '../utils/ensureErrorType';
10-
import { nonNullProp } from '../utils/nonNull';
7+
import { isError } from '../utils/ensureErrorType';
118
import { WorkerChannel } from '../WorkerChannel';
129
import { EventHandler } from './EventHandler';
1310
import LogCategory = rpc.RpcLog.RpcLogCategory;
@@ -33,34 +30,9 @@ export class WorkerInitHandler extends EventHandler<'workerInitRequest', 'worker
3330
});
3431

3532
logColdStartWarning(channel);
36-
const functionAppDirectory = nonNullProp(msg, 'functionAppDirectory');
37-
await channel.updatePackageJson(functionAppDirectory);
38-
39-
const entryPointFile = channel.packageJson.main;
40-
if (entryPointFile) {
41-
channel.log({
42-
message: `Loading entry point "${entryPointFile}"`,
43-
level: LogLevel.Debug,
44-
logCategory: LogCategory.System,
45-
});
46-
try {
47-
const entryPointFullPath = path.join(functionAppDirectory, entryPointFile);
48-
if (!(await pathExists(entryPointFullPath))) {
49-
throw new Error(`file does not exist`);
50-
}
51-
52-
await loadScriptFile(entryPointFullPath, channel.packageJson);
53-
channel.log({
54-
message: `Loaded entry point "${entryPointFile}"`,
55-
level: LogLevel.Debug,
56-
logCategory: LogCategory.System,
57-
});
58-
} catch (err) {
59-
const error = ensureErrorType(err);
60-
error.isAzureFunctionsInternalException = true;
61-
error.message = `Worker was unable to load entry point "${entryPointFile}": ${error.message}`;
62-
throw error;
63-
}
33+
const functionAppDirectory = msg.functionAppDirectory;
34+
if (functionAppDirectory) {
35+
await channel.updatePackageJson(functionAppDirectory);
6436
}
6537

6638
response.capabilities = {

test/eventHandlers/WorkerInitHandler.test.ts

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
import { expect } from 'chai';
55
import * as escapeStringRegexp from 'escape-string-regexp';
66
import 'mocha';
7+
import { ITestCallbackContext } from 'mocha';
78
import * as mockFs from 'mock-fs';
89
import { AzureFunctionsRpcMessages as rpc } from '../../azure-functions-language-worker-protobuf/src/rpc';
910
import { logColdStartWarning } from '../../src/eventHandlers/WorkerInitHandler';
@@ -213,7 +214,10 @@ describe('WorkerInitHandler', () => {
213214
});
214215

215216
for (const extension of ['.js', '.mjs', '.cjs']) {
216-
it(`Loads entry point (${extension})`, async () => {
217+
it(`Loads entry point (${extension})`, async function (this: ITestCallbackContext) {
218+
// Should be re-enabled after https://github.com/Azure/azure-functions-nodejs-worker/pull/577
219+
this.skip();
220+
217221
const fileName = `entryPointFiles/doNothing${extension}`;
218222
const expectedPackageJson = {
219223
main: fileName,
@@ -236,7 +240,10 @@ describe('WorkerInitHandler', () => {
236240
});
237241
}
238242

239-
it('Fails for missing entry point', async () => {
243+
it('Fails for missing entry point', async function (this: ITestCallbackContext) {
244+
// Should be re-enabled after https://github.com/Azure/azure-functions-nodejs-worker/pull/577
245+
this.skip();
246+
240247
const fileName = 'entryPointFiles/missing.js';
241248
const expectedPackageJson = {
242249
main: fileName,
@@ -257,7 +264,10 @@ describe('WorkerInitHandler', () => {
257264
);
258265
});
259266

260-
it('Fails for invalid entry point', async () => {
267+
it('Fails for invalid entry point', async function (this: ITestCallbackContext) {
268+
// Should be re-enabled after https://github.com/Azure/azure-functions-nodejs-worker/pull/577
269+
this.skip();
270+
261271
const fileName = 'entryPointFiles/throwError.js';
262272
const expectedPackageJson = {
263273
main: fileName,

0 commit comments

Comments
 (0)