diff --git a/.changeset/warm-moles-learn.md b/.changeset/warm-moles-learn.md new file mode 100644 index 00000000..b3651dd1 --- /dev/null +++ b/.changeset/warm-moles-learn.md @@ -0,0 +1,6 @@ +--- +'twilio-run': patch +'@twilio-labs/plugin-serverless': patch +--- + +Fix of debug/inspect mode by disabling fork process diff --git a/packages/twilio-run/__tests__/config/start.test.ts b/packages/twilio-run/__tests__/config/start.test.ts index 6ded1a0d..0c269bcf 100644 --- a/packages/twilio-run/__tests__/config/start.test.ts +++ b/packages/twilio-run/__tests__/config/start.test.ts @@ -285,4 +285,18 @@ describe('getConfigFromCli', () => { expect(startConfig.baseDir).toEqual(path.resolve(config.cwd)); } }); + + test('turns off fork process if inspect is enabled', async () => { + require('../../src/config/utils/package-json').__setPackageJson({}); + const config = { + dir: './other_dir', + inspect: '', + } as unknown as StartCliFlags; + if (config.dir) { + const startConfig = await getConfigFromCli(config); + expect(startConfig.baseDir).toEqual(path.resolve(config.dir)); + expect(startConfig.forkProcess).toEqual(false); + expect(startConfig.inspect).not.toEqual(undefined); + } + }); }); diff --git a/packages/twilio-run/src/config/start.ts b/packages/twilio-run/src/config/start.ts index 5f5179b3..2d5df6be 100644 --- a/packages/twilio-run/src/config/start.ts +++ b/packages/twilio-run/src/config/start.ts @@ -186,6 +186,12 @@ export async function getConfigFromCli( config.assetsFolderName = cli.assetsFolder; config.functionsFolderName = cli.functionsFolder; config.forkProcess = cli.forkProcess; + + if (typeof config.inspect !== 'undefined') { + debug('Disabling fork-process in inspect mode.'); + config.forkProcess = false; + } + config.pkgJson = pkgJson; return config;