Hello, I have had success with the D1 in

Hello, I have had success with the D1 in development all the way until production deployment. I have bound it using the updated syntax from docs (Pages). When i attempt to query when deployed, It crashes with Application Error. Works just fine in wrangler preview. AccountId: 77e1b1d919d86d253e4967517aab4437
4 Replies
Miyagi
MiyagiOP•7mo ago
Update from npx wrangler pages deployment tail: Connected to deployment 79f5aed8-9321-4eec-b5bd-0ac6ddf5cce0, waiting for logs... GET https://79f5aed8.test-env-3mx.pages.dev/staffing - Ok @ 5/3/2024, 5:15:57 PM (error) Failed to fetch all employees: TypeError: Cannot read properties of undefined (reading 'prepare') (error) TypeError: Cannot read properties of undefined (reading 'prepare') (error) Error: Unexpected Server Error
Isaac McFadyen
Isaac McFadyen•7mo ago
Looks like your binding is undefined - can you check to make sure you're accessing it on the right binding name? If your binding is named EXAMPLE you'll need to access it in Pages with EXAMPLE too
Miyagi
MiyagiOP•7mo ago
Thanks for the response, I prepared a detailed rebuttable just for a light bulb to go off mid message. It helps to explicitly define my types. changing: private db; to private:db : TYPE changes it from undefined to defined :feelskek2: I'm trying here man :'). Thanks again for your help! RESOLVED.
No description
Isaac McFadyen
Isaac McFadyen•7mo ago
Great, glad you got it sorted 😄
Want results from more Discord servers?
Add your server