I have upgraded my function to .net 8, I am using a linq query to get data from tblConfiguration, I am get this exception on the deployed function on our staging environment, production runs fine (it is still on .net 6) I have not changed the dbcontext, model that maps the table or the linq query. The api runs successfully on localhost connected to the staging environment database, the data is returned from the table, but when I deploy it and hit the api it results in the exception
Result: An exception occurred while iterating over the results of a query for context type ‘MyApi.Models.DBContext’.
‘MyApi.Models.DBContext’. Microsoft.Data.SqlClient.SqlException (0x80131904): Invalid object name ‘tblConfiguration’
I have checked that the table exists and the name is correct, and I’m using the same connection string to staging database on localhost and the deployed function. I tried adding the [Table(“tblConfiguration”)] to the model class but it did not work on the deployed function.
I have tried executing a raw query on our health check endpoint
select top 1 id from tblConfiguration
and it does return the data on the deployed function’s health check endpoint