Getting CORS error while calling a lambda function

Is there a way to have that config accessible to the web side ?

This doesn’t work:

import { getConfig } from '@redwoodjs/internal'

const redwoodConfig = getConfig()
const url = `http://localhost:${redwoodConfig.api.port}${redwoodConfig.web.apiProxyPath}/hello`

Get a Cannot find module 'fs' error.

Thanks.