Crash on Azure Functions with dacpac/SSDT provider: `extractModelXml` fails due to read-only filesystem.
varon opened this issue · 0 comments
varon commented
Describe the bug
Thanks for releasing 1.2.8. This let us get a little further with getting the SqlProvider running on Azure Functions.
We are seeing a crash on loading a dacpac file with this, as it seems like the file system is read-only.
"Read-only file system"
Why are we even loading the .dacpac at all at runtime? Surely it should just default over to the regular SqlClient instead?
Full stacktrace/logs:
2021-08-09T14:53:29Z [Critical] [SqlDb]:Failed to create database context!!
2021-08-09T14:53:29Z [Critical] [SqlDb]:exn type: System.IO.IOException, msg: Read-only file system
Stacktrace:
at Interop.ThrowExceptionForIoErrno(ErrorInfo errorInfo, String path, Boolean isDirectory, Func`2 errorRewriter)
at Microsoft.Win32.SafeHandles.SafeFileHandle.Open(String path, OpenFlags flags, Int32 mode)
at System.IO.FileStream.OpenHandle(FileMode mode, FileShare share, FileOptions options)
at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, FileOptions options)
at FSharp.Data.Sql.Ssdt.DacpacParser.extractModelXml(String dacPacPath)
at FSharp.Data.Sql.Providers.MSSqlServerSsdt.parseDacpac@80.Invoke(String x)
at System.Lazy`1.ViaFactory(LazyThreadSafetyMode mode)
at System.Lazy`1.ExecutionAndPublication(LazyHelper executionAndPublication, Boolean useDefaultConstructor)
at System.Lazy`1.CreateValue()
at FSharp.Data.Sql.Providers.MSSqlServerProviderSsdt.FSharp-Data-Sql-Common-ISqlProvider-GetTables(IDbConnection con, CaseSensitivityChange _arg1)
at <StartupCode$FSharp-Data-SqlProvider>.$SqlRuntime.DataContext.addCache@38-1.Invoke(Unit unitVar)
at System.Lazy`1.ViaFactory(LazyThreadSafetyMode mode)
at System.Lazy`1.ExecutionAndPublication(LazyHelper executionAndPublication, Boolean useDefaultConstructor)
at System.Lazy`1.CreateValue()
at System.Lazy`1.get_Value()
at FSharp.Data.Sql.Runtime.SqlDataContext..ctor(String typeName, String connectionString, DatabaseProviderTypes providerType, String resolutionPath, String[] referencedAssemblies, String runtimeAssembly, String owner, CaseSensitivityChange caseSensitivity, String tableNames, String contextSchemaPath, OdbcQuoteCharacter odbcquote, SQLiteLibrary sqliteLibrary, TransactionOptions transactionOptions, FSharpOption`1 commandTimeout, SelectOperations sqlOperationsInSelect, String ssdtPath)
To Reproduce
Steps to reproduce the behavior:
This is complex to reproduce as it requires a lot of infrastructure:
- Deploy to Azure Functions
- Use a SSDT provider
- Wire up the dacpac path correctly (thanks, 1.2.8)
- Hit an endpoint that interacts with the database
- watch the fireworks
Expected behavior
World peace, F# replacing C#, and a non-crashing provider on Azure Functions.
Desktop (please complete the following information):
- OS: Azure Functions V3 (Linux, .Net Core 3.1)