Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions README.MD
Original file line number Diff line number Diff line change
Expand Up @@ -89,8 +89,10 @@ To test that database deployment was successful and that OpenAI connection is wo

```sql
declare @v vector(1536)
exec [web].[get_embedding] 'just a sample text', @v output
select @v
declare @e varchar(max)
exec [web].[get_embedding] 'just a sample text', @v output ,@e output
select @v,@e

```

if no error are returned, you'll get a vector as a result.
Expand Down Expand Up @@ -120,6 +122,7 @@ The easiest way to deploy the full-stack application is to fork the repository a
Make sure you give the user thay you are using to connect to the database the permission to run the needed stored procedures:

```sql
GRANT SELECT ON SCHEMA::[dbo] TO [<your user>]
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should not be needed as 'web' schema is owned by 'dbo'. What do you see not working if you don't give this permission?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If the user used for the data source connection does not have SELECT permission on dbo, the following error occurs in Data API Builder.
The website also displays this error.
Are there any other appropriate workarounds?

fail: Azure.DataApiBuilder.Service.Startup[0]
      Unable to complete runtime initialization. Refer to exception for error details.
      Azure.DataApiBuilder.Service.Exceptions.DataApiBuilderException: Cannot obtain Schema for entity Samples with underlying database object source: dbo.samples due to: The SELECT permission was denied on the object 'samples', database 'aisearchdb', schema 'dbo'.
         at Azure.DataApiBuilder.Core.Services.SqlMetadataProvider`3.HandleOrRecordException(Exception e) in /_/src/Core/Services/MetadataProviders/SqlMetadataProvider.cs:line 100
         at Azure.DataApiBuilder.Core.Services.SqlMetadataProvider`3.PopulateObjectDefinitionForEntity(String entityName, Entity entity) in /_/src/Core/Services/MetadataProviders/SqlMetadataProvider.cs:line 1116
         at Azure.DataApiBuilder.Core.Services.SqlMetadataProvider`3.PopulateObjectDefinitionForEntities() in /_/src/Core/Services/MetadataProviders/SqlMetadataProvider.cs:line 1054
         at Azure.DataApiBuilder.Core.Services.SqlMetadataProvider`3.InitializeAsync() in /_/src/Core/Services/MetadataProviders/SqlMetadataProvider.cs:line 289
         at Azure.DataApiBuilder.Core.Services.MetadataProviders.MetadataProviderFactory.InitializeAsync() in /_/src/Core/Services/MetadataProviders/MetadataProviderFactory.cs:line 92
         at Azure.DataApiBuilder.Service.Startup.PerformOnConfigChangeAsync(IApplicationBuilder app) in /_/src/Service/Startup.cs:line 649
info: Microsoft.Hosting.Lifetime[0]
      Application is shutting down...
fail: Azure.DataApiBuilder.Service.Startup[0]
      Could not initialize the engine with the runtime config file: staticwebapp.database.config.json
⠼ Waiting for http://localhost:5173 to be readyfail: Microsoft.Extensions.Hosting.Internal.Host[11]
      Hosting failed to start
      System.Threading.Tasks.TaskCanceledException: A task was canceled.
         at Microsoft.AspNetCore.Server.Kestrel.Core.KestrelServerImpl.BindAsync(CancellationToken cancellationToken)
         at Microsoft.AspNetCore.Server.Kestrel.Core.KestrelServerImpl.StartAsync[TContext](IHttpApplication`1 application, CancellationToken cancellationToken)
         at Microsoft.AspNetCore.Hosting.GenericWebHostService.StartAsync(CancellationToken cancellationToken)     
         at Microsoft.Extensions.Hosting.Internal.Host.<StartAsync>b__15_1(IHostedService service, CancellationToken token)
         at Microsoft.Extensions.Hosting.Internal.Host.ForeachService[T](IEnumerable`1 services, CancellationToken 
token, Boolean concurrent, Boolean abortOnFirstException, List`1 exceptions, Func`3 operation)
Unable to launch the Data API builder engine.
Error: Failed to start the engine.

image

GRANT EXECUTE ON SCHEMA::[web] TO [<your user>]
GRANT EXECUTE ANY EXTERNAL ENDPOINT TO [<your user>];
GRANT REFERENCES ON DATABASE SCOPED CREDENTIAL::[<openai_url>] TO [<your user>];
Expand Down