This doesn't work for your specific case but it could for someone else with a similar issue. Check that env.config() comes before you initialize your db