Erik Robertson
10/14/2021, 8:52 PMERROR Error: Cannot find module '/Users/erik/src/dataworks/dwam-back/.build/src/../config/config.js'
at runtime in local debug mode when calling the /list lambda endpoint where I'm adding Sequelize.
My project structure is like this :
/sst.json
/package.json
/stacks
/src/list.js my lambda endpoint, which does an import { db } from '../models';
/models/index.js which does a const config = require(__dirname + '/../config/config.js')[env];
/config/config.js
I see two possible issues :
1. In my .build folder there is a src subfolder but no models or config subfolders
2. the error above comes from .build/src/list.js where models/index.js has been included into this flattened version of list.js but in that context the dynamic require could be pointing to a different folder than intended when authoring it (in my case it's ok since src+models+config are under the root /
Any help would be welcome. It might be bad JS usage of my end of import/require since I'm not yet fully comfortable with those and the implications, but I've tried other variants without success + it wouldn't address issue #1 AFAIK.thdxr
10/14/2021, 9:15 PMthdxr
10/14/2021, 9:15 PMErik Robertson
10/14/2021, 10:16 PMthdxr
10/14/2021, 10:18 PMErik Robertson
10/14/2021, 10:25 PMthdxr
10/14/2021, 10:27 PMthdxr
10/14/2021, 10:27 PMErik Robertson
10/14/2021, 10:32 PMthdxr
10/14/2021, 10:33 PM