Astro.js with cloudflare adapter gives 404

i have astro project that works normaly with cloudflare adapter on cloudflare pages. when i add files in /functions dir i always get 404 response.

my astro config is:
export default defineConfig({
output: “server”,
adapter: cloudflare({
mode: ‘directory’,
functionPerRoute: true
})