Posting in case others have hit this β and hoping someone's cracked it.
After converting a classic app to a React/code (R2) app, my backend functions can't see their Postgres resource handle in the published runtime. The exact same functions work fine in editor/preview. In production they throw ReferenceError: <resourceHandle> is not defined before any SQL runs.
What I've confirmed so far:
-
Editor/preview: handle present, DB round-trips succeed.
-
Published: handle absent on the same functions β including a freshly authored test function, so it's not a stale migrated file.
-
A DB ping function fails identically, so it isn't auth/credential/SQL logic.
-
package.jsonβresourceReferencesByFileshows empty arrays for both working and failing functions, so it doesn't seem to reflect actual binding. Hand-editing it made no difference.
Reads like the published runtime isn't injecting backend SQL resource handles for converted R2/code apps.
Has anyone:
-
Got a backend SQL/Postgres resource working in a published converted R2/code app?
-
Found the UI step / app-level resource allowlist / env config that makes the handle available after publish?
-
Heard whether this is a known classicβR2 conversion issue?
Any pointers gratefully received β happy to share more detail or a minimal repro. Thanks.
For in-depth findings, see docs in New React Retool App - Findings Log - Google Drive