diff --git a/src/utils/functions/functions.ts b/src/utils/functions/functions.ts index 69650ee1dda..d963cbda1d8 100644 --- a/src/utils/functions/functions.ts +++ b/src/utils/functions/functions.ts @@ -58,7 +58,5 @@ export const getInternalFunctionsDir = async ({ base, ensureExists, packagePath await fs.mkdir(path, { recursive: true }) } - const isDirectory = await isDirectoryAsync(path) - - return isDirectory ? path : null + return path } diff --git a/tests/integration/commands/functions-with-args/functions-with-args.test.js b/tests/integration/commands/functions-with-args/functions-with-args.test.js index 84fed497917..a3b90c1c310 100644 --- a/tests/integration/commands/functions-with-args/functions-with-args.test.js +++ b/tests/integration/commands/functions-with-args/functions-with-args.test.js @@ -494,7 +494,7 @@ exports.handler = async () => ({ }) }) - test.skip('Serves functions from the internal functions directory', async (t) => { + test('Serves functions from the internal functions directory', async (t) => { await withSiteBuilder('function-internal', async (builder) => { const bundlerConfig = args.includes('esbuild') ? { node_bundler: 'esbuild' } : {} @@ -506,17 +506,22 @@ exports.handler = async () => ({ ...bundlerConfig, }, }) - .withFunction({ - path: 'hello.js', - pathPrefix: '.netlify/functions-internal', - handler: async () => ({ - statusCode: 200, - body: 'Internal', - }), - }) - .buildAsync() + .build() await withDevServer({ cwd: builder.directory, args }, async ({ outputBuffer, port, waitForLogMatching }) => { + await builder + .withFunction({ + path: 'hello.js', + pathPrefix: '.netlify/functions-internal', + handler: async () => ({ + statusCode: 200, + body: 'Internal', + }), + }) + .build() + + await pause(WAIT_WRITE) + await tryAndLogOutput(async () => { t.expect(await fetch(`http://localhost:${port}/.netlify/functions/hello`).then((res) => res.text())).toEqual( 'Internal',