Hmm interesting! So I have refactored my code and created two utility modules inside of the /funct

Hmm interesting!

So I have refactored my code and created two utility modules inside of the /functions directory:
  • One for mailing functionality
  • One for google oauth token fetching
I have exported async functions from both, importing into my actual api endpoints exporting onRequest() - and current functionality is as expected

I have also tested if there was any routes deployed in dev mode using npx wrangler pages dev out/ for the utility modules in /functions & am getting 404 errors for both but I'm not sure if this will replicate to prod

I did a search in this discord regarding 'utility functions' and seem to have found one screenshot discussing a similar problem, but I couldn't find any solid citations in the docs so I thought to double check here

So in general, is the correct way to handle utilities and helper methods in the /functions dir to define them outside of the /functions dir and import them in?
Or do we just trust that wrangler will appropriately deal with any code in the /functions dir that doesn't export onRequest?
image.png
image.png
image.png
Was this page helpful?