Hello!
I can connect to remote postgresql database in heroku when I run the code locally by using “netlify dev” but it doesn not work when I deploy it in netlify.
When I use it from the “hello.js” netlify function, the error in netlify log is:
Jan 18, 10:39:00 PM: 876873b5 ERROR Error is: TypeError: import_Colors.default.findOne is not a function
at Runtime.handler (/var/task/netlify/functions/hello.js:37:47)
at Runtime.handleOnceNonStreaming (file:///var/runtime/index.mjs:1173:29)
it seems like it does not recognize findOne when the app deployed in the netlify site, but again locally the same code works just fine.
It seems like it is “sequelize” ORM issue only because I can run SQL statements without any problems when the code is deployed in the netlify site.
Any thoughts why it is happening and how to fix it?
I am NOT trying to run any database or server in Netlify.
My database is hosted by Heroku. Heroku provides the url that I use to connect to the postgresql database in Heroku remotely.
My little test web app can be hosted by either my local machine OR by Netlify site, it is static JS/React code, it is not a server.
When I run this code locally on my machine I am able to connect to the Heroku database using “sequelize” without any problem using “netlify dev” and without it. That means that Heroku database can be connected from anywhere.
But when I deploy the exactly same test app and run it in netlify site it cannot use “sequelize” with remote Heroky database.
Why?