Skip to content

Conversation

@saidtaylan
Copy link
Contributor

Problem

When deploying the functions pod, the edge-runtime fails to start with the following error:

runtime has escaped from the event loop unexpectedly: Module not found: file:///var/tmp/sb-compile-edge-runtime/main/index.ts
main worker has been destroyed
Module not found: file:///var/tmp/sb-compile-edge-runtime/main/index.ts

Root Cause

When a ConfigMap is mounted as a volume without subPath, Kubernetes creates a directory structure with symbolic links for atomic updates:

/home/deno/functions/main/
├── ..data -> ..2024_12_30_timestamp/
├── ..2024_12_30_timestamp/
│   └── index.ts
└── index.ts -> ..data/index.ts  (symlink)

The edge-runtime compiles and caches the TypeScript files to /var/tmp/sb-compile-edge-runtime/. When it tries to resolve the symlinked index.ts, the path resolution breaks and the runtime cannot locate the module.

Adding subPath: index.ts to the volume mount ensures the file is mounted directly as a regular file rather than as a symlink:

- mountPath: /home/deno/functions/main/index.ts
  name: functions-main
  subPath: index.ts

This allows the edge-runtime to correctly read and compile the main service entry point.

@luizfelmach
Copy link
Contributor

Thank you for the fantastic work @saidtaylan — this is really great.

This change fixes the errors that were occurring in the most recent versions of edge-runtime, such as v1.69.28.
With the values.example.yaml using version v1.68.4, I didn’t encounter this issue.
I really appreciate your effort on this.

This looks good to me and can be merged.

@aantti
Copy link
Contributor

aantti commented Dec 31, 2025

Thanks!

@aantti aantti self-assigned this Dec 31, 2025
@luizfelmach
Copy link
Contributor

@saidtaylan Try bump version for 0.2.2 of Chart.

@saidtaylan
Copy link
Contributor Author

I have updated chart version to 2.2 as you said. @luizfelmach

@aantti aantti merged commit cc4ee2b into supabase-community:main Dec 31, 2025
1 check passed
@luizfelmach
Copy link
Contributor

Thanks @saidtaylan 🎉

@saidtaylan saidtaylan deleted the functions-deployment branch January 2, 2026 06:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants