Re-index database tables Error

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.
4 years ago
After updating to 4.2 getting error when ruining re-index

Cannot find the object "WebHooks" because it does not exist or you do not have permissions.

Full message  
System.Data.SqlClient.SqlException (0x80131904): Cannot find the object "WebHooks" because it does not exist or you do not have permissions.
   at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection, Action`1 wrapCloseInAction)
   at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj, Boolean callerHasConnectionLock, Boolean asyncClose)
   at System.Data.SqlClient.TdsParser.TryRun(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj, Boolean& dataReady)
   at System.Data.SqlClient.SqlCommand.RunExecuteNonQueryTds(String methodName, Boolean async, Int32 timeout, Boolean asyncWrite)
   at System.Data.SqlClient.SqlCommand.InternalExecuteNonQuery(TaskCompletionSource`1 completion, Boolean sendToPipe, Int32 timeout, Boolean asyncWrite, String methodName)
   at System.Data.SqlClient.SqlCommand.ExecuteNonQuery()
   at Microsoft.EntityFrameworkCore.Storage.Internal.RelationalCommand.Execute(IRelationalConnection connection, DbCommandMethod executeMethod, IReadOnlyDictionary`2 parameterValues)
   at Microsoft.EntityFrameworkCore.Storage.Internal.RelationalCommand.ExecuteNonQuery(IRelationalConnection connection, IReadOnlyDictionary`2 parameterValues)
   at Microsoft.EntityFrameworkCore.RelationalDatabaseFacadeExtensions.ExecuteSqlCommand(DatabaseFacade databaseFacade, RawSqlString sql, IEnumerable`1 parameters)
   at Nop.Data.NopObjectContext.ExecuteSqlCommand(RawSqlString sql, Boolean doNotEnsureTransaction, Nullable`1 timeout, Object[] parameters) in C:\andrei\nopcommerce\sources\src\Libraries\Nop.Data\NopObjectContext.cs:line 144
   at Nop.Services.Common.MaintenanceService.ReIndexTables() in C:\andrei\nopcommerce\sources\src\Libraries\Nop.Services\Common\MaintenanceService.cs:line 204
   at Nop.Web.Areas.Admin.Controllers.CommonController.ReIndexTables(MaintenanceModel model) in C:\andrei\nopcommerce\sources\src\Presentation\Nop.Web\Areas\Admin\Controllers\CommonController.cs:line 237
ClientConnectionId:ad7650b2-1fee-4c06-8419-fdd9a0dc8fd6
Error Number:1088,State:9,Class:16
4 years ago
Did you ever find out what the problem was?  I have the same error.

deselt wrote:
After updating to 4.2 getting error when ruining re-index

Cannot find the object "WebHooks" because it does not exist or you do not have permissions.

Full message  
System.Data.SqlClient.SqlException (0x80131904): Cannot find the object "WebHooks" because it does not exist or you do not have permissions.
   at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection, Action`1 wrapCloseInAction)
   at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj, Boolean callerHasConnectionLock, Boolean asyncClose)
   at System.Data.SqlClient.TdsParser.TryRun(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj, Boolean& dataReady)
   at System.Data.SqlClient.SqlCommand.RunExecuteNonQueryTds(String methodName, Boolean async, Int32 timeout, Boolean asyncWrite)
   at System.Data.SqlClient.SqlCommand.InternalExecuteNonQuery(TaskCompletionSource`1 completion, Boolean sendToPipe, Int32 timeout, Boolean asyncWrite, String methodName)
   at System.Data.SqlClient.SqlCommand.ExecuteNonQuery()
   at Microsoft.EntityFrameworkCore.Storage.Internal.RelationalCommand.Execute(IRelationalConnection connection, DbCommandMethod executeMethod, IReadOnlyDictionary`2 parameterValues)
   at Microsoft.EntityFrameworkCore.Storage.Internal.RelationalCommand.ExecuteNonQuery(IRelationalConnection connection, IReadOnlyDictionary`2 parameterValues)
   at Microsoft.EntityFrameworkCore.RelationalDatabaseFacadeExtensions.ExecuteSqlCommand(DatabaseFacade databaseFacade, RawSqlString sql, IEnumerable`1 parameters)
   at Nop.Data.NopObjectContext.ExecuteSqlCommand(RawSqlString sql, Boolean doNotEnsureTransaction, Nullable`1 timeout, Object[] parameters) in C:\andrei\nopcommerce\sources\src\Libraries\Nop.Data\NopObjectContext.cs:line 144
   at Nop.Services.Common.MaintenanceService.ReIndexTables() in C:\andrei\nopcommerce\sources\src\Libraries\Nop.Services\Common\MaintenanceService.cs:line 204
   at Nop.Web.Areas.Admin.Controllers.CommonController.ReIndexTables(MaintenanceModel model) in C:\andrei\nopcommerce\sources\src\Presentation\Nop.Web\Areas\Admin\Controllers\CommonController.cs:line 237
ClientConnectionId:ad7650b2-1fee-4c06-8419-fdd9a0dc8fd6
Error Number:1088,State:9,Class:16
4 years ago
'WebHooks' is not a table in 4.2

Looking at the ReIndexTables() method in MaintenceService.cs, it is pulling the table names with:

                SELECT table_name
                FROM [{_dbContext.DbName()}].information_schema.tables
                WHERE table_type = 'base table'


I am unfamiliar with previous versions of NopCommerce and the upgrade process, but I would step through the upgrade scripts to figure out what was supposed to happen with the WebHooks table.  Assuming the data is no longer needed then dropping the WebHooks table from the db should fix this error.
4 years ago
Are you perhaps using the Sevenspikes API?  They utilize a Webhooks table:
https://github.com/SevenSpikes/api-plugin-for-nopcommerce/commit/b33bf36eccfb3cbb22d0f3513f1593d863c0206c

So if that Webhooks table exists make sure the db user has select permission granted for it.   If the user already has select permission, which it probably does if the api was working, then look into the  "view definition" permission.  (Obviously don't drop the table if it's still in use!)
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.