Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Philip Hayton 98 posts 435 karma points
    Sep 26, 2022 @ 21:10
    Philip Hayton
    0

    Upgrading to v3 on Umbraco Cloud

    Hi Matt,

    I've just pushed up my first code change up to Umbraco Cloud after upgrading to Vendr v3.0.0 but the environment is failing to start, throwing this error.

    System.ApplicationException: Unable to run migrations as no upgrade engine found for the configured provider: System.Data.SqlClient
     at Vendr.Persistence.Migrations.DbUpVendrMigrationsRunner.MigrateUp()
    

    It's not doing this locally and I just wanted to make sure I'm not missing anything cloud-specific for the upgrade to v3?

    As always any help is greatly appreciated!

  • Matt Brailsford 4124 posts 22215 karma points MVP 9x c-trib
    Sep 27, 2022 @ 08:10
    Matt Brailsford
    0

    Hey Philip

    This is a known issue in Azure that for some reason it always reverts to System.Data.SqlClient when it should be using Microsoft.Data.SqlClient. Whilst it is Vendr's migrations that is throwing this error, Umbraco itself would suffer from the same issue as it's also built to use Microsoft.Data.SqlClient.

    Generally speaking, you'd need to define a provider name entry in your connection strings section in app settings. You can find and example of it here https://vendr.net/docs/core/3.0.0/how-to-guides/use-an-alternative-database-for-vendr-tables/

    Saying this though, some have still had problems with Azure reverting this and so they have had to setup those app settings in the azure portal. How you would do this on cloud though I have no idea.

    It may be worth mentioning this to Cloud support as like I say, whilst it's a Vendr error, it's very much an Umbraco rooted issue too.

  • Ronald Barendse 39 posts 217 karma points hq c-trib
    Sep 27, 2022 @ 09:00
    Ronald Barendse
    0

    The provider name is automatically set when using environment variables with special prefixes and we've included a fix during the RC-period for Umbraco 10 to automatically change System.Data.SqlClient to Microsoft.Data.SqlClient (see PR #12408).

    You can either not use the special prefixes (but set ConnectionStrings:{KEY} and ConnectionStrings:{KEY}_ProviderName yourself) or include a similar fix to automatically replace the provider name with the supported one.

  • Philip Hayton 98 posts 435 karma points
    Sep 27, 2022 @ 10:08
    Philip Hayton
    0

    Hi Ronald,

    I have tried setting appsettings.json to the following for every environment but it didn't seem to have any effect:

      "ConnectionStrings": {
        "umbracoDbDSN_ProviderName": "Microsoft.Data.SqlClient",
        "vendrDbDSN_ProviderName": "Microsoft.Data.SqlClient"
      },
    

    Do I need to explicitly provide the connection string too?

    Kind regards

    Phil

  • Matt Brailsford 4124 posts 22215 karma points MVP 9x c-trib
    Sep 27, 2022 @ 10:57
    Matt Brailsford
    0

    Hey Philip,

    If Vendr is installed in the Umbraco database you only need to concern yourself with the umbracoDbDSN connection strings. You only need the vendr specific ones if you are storing your Vendr data in a separate DB.

    From what Ronald has said though it sounds like it should be handled automatically.

    The only thing I can wonder from a Vendr perspective is that we resolve the connection string ourseleves from IConfiguration in a singleton service but maybe we need to make that transient.

    Or maybe our migrations run before Umbraco has applied that fix 🤔

    EDIT Just checked and our migrations run in an INotificationHandler<UmbracoApplicationStartingNotification> event handler so that should defo be after Umbraco has applied the fix.

  • Matt Brailsford 4124 posts 22215 karma points MVP 9x c-trib
    Sep 27, 2022 @ 11:02
    Matt Brailsford
    0

    Ahhh, ok, I see.

    The fix Ronald mentions only relates to Umbracos ConnectionStrings object, so the fix would only work for anyone referencing the connection string through this API and not the standard .NET one of IConfiguration.GetConnectionString() and so when I request it via this API it incorrectly uses the System.Data.SqlClient connection string.

    Sounds like I would either need to use Umbraco's ConnectionStrings object, or just implement a similar fix somewhere to replace System.Data.SqlClient with Microsoft.Data.SqlClient

  • Matt Brailsford 4124 posts 22215 karma points MVP 9x c-trib
    Sep 27, 2022 @ 11:27
    Matt Brailsford
    101

    Ok, I've posted an update to our unstable NuGet feed at https://nuget.outfield.digital/unstable/vendr/v3/index.json if you want to install the 3.0.1-beta00053 version on there it should resolve this issue in a similar way to Umbraco.

    Let me know if you are able to try it and whether it resolves your issue.

  • Philip Hayton 98 posts 435 karma points
    Sep 27, 2022 @ 12:18
    Philip Hayton
    0

    Hi Matt,

    I've bumped the version in my project but the deploy is failing because it can't find the package on the default nuget feed.

    I've opened a ticket with cloud to ask how to add a custom feed, but just leaving this here incase anyone else knows the answer.

    Cheers

    Phil

  • Philip Hayton 98 posts 435 karma points
    Sep 27, 2022 @ 12:57
    Philip Hayton
    1

    Good news, that's worked a treat 👍🏻 thanks so much for the quick turn around on that Matt I really appreciate it.

  • Matt Brailsford 4124 posts 22215 karma points MVP 9x c-trib
    Sep 27, 2022 @ 15:03
    Matt Brailsford
    0

    Excellent, I'll give it a few days before I fully release just to see if any more v3 bugs come along but I'll make sure that gets released end of the week / early next.

    Just as an FYI I also have an updated v3-rc of Vendr Deploy on that feed so you may want to try than for v10 on cloud too. I need to run some tests on some updates though, but I need to setup a cloud environment to do that which I'll be trying to do tomorrow.

    If you do try it though, let me know if you find any issues.

  • Ronald Barendse 39 posts 217 karma points hq c-trib
    Oct 03, 2022 @ 13:55
    Ronald Barendse
    1

    @Matt: Great to see you've already released a fix for this!

    @Philip: Setting the provider name configuration values in appsettings.json won't work, because environment variables will overwrite them (at least in the default configuration source order).

    Umbraco Cloud sets the environment variable SQLAZURECONNSTR_umbracoDbDSN to the Azure SQL Database connection string, which automatically sets ConnectionStrings:umbracoDbDSN to this connection string and ConnectionStrings:umbracoDbDSN_ProviderName to System.Data.SqlClient.

    This works fine for Umbraco, because it will automatically change the provider name to Microsoft.Data.SqlClient on the ConnectionStrings options instance, ensuring the CMS/NPoco uses the correct provider to connect to the database.

    Vendr 3 now uses its own database layer that also uses Microsoft.Data.SqlClient for SQL Server connection strings, hence it also needs to include a fix to automatically use the correct provider.

  • Becky Baker 6 posts 76 karma points
    Oct 24, 2022 @ 18:52
    Becky Baker
    0

    Hello,

    I've got this exact issue at the moment and I can't seem to find a way to solve it. I've got the latest version of Vendr (3.0.3) and using Umbraco 10 on cloud.

    Is there a way to solve this?

    Thanks for any advice Becky

  • Philip Hayton 98 posts 435 karma points
    Oct 24, 2022 @ 21:10
    Philip Hayton
    0

    Hi Becky,

    Add the unstable Vendr nuget feed to your Nuget package manager, here's the URL: https://nuget.outfield.digital/unstable/vendr/v3/index.json

    Then install the latest pre-release version of Vendr Deploy, I am currently using 3.0.1-beta0001 and it works fine.

    You'll also need to add the feed to the Nuget.config file at the absolute root of your cloud solution.

    <?xml version="1.0" encoding="utf-8"?>
    <configuration>
      <packageSources>
        <add key="nuget.org" value="https://api.nuget.org/v3/index.json" />
        <add key="vendr.unstable" value="https://nuget.outfield.digital/unstable/vendr/v3/index.json" />
      </packageSources>
    
      <activePackageSource>
        <add key="All" value="(Aggregate source)" />
      </activePackageSource>
    
    </configuration>
    
  • Matt Brailsford 4124 posts 22215 karma points MVP 9x c-trib
    Oct 25, 2022 @ 08:56
    Matt Brailsford
    0

    This shouldn't be necesarry as the fix was added in the 3.0.1 release, which being on 3.0.3 should mean it's also applied.

    @Becky, when you say you have the exact issue, is it truly the exact error?

    Unable to run migrations as no upgrade engine found for the configured provider: System.Data.SqlClient
    
  • Becky Baker 6 posts 76 karma points
    Oct 25, 2022 @ 09:30
    Becky Baker
    0

    Hi Philip and Matt

    Thank you so much for your quick reply.

    Philip I have done that now. Matt, yes that was the exact message I was getting but I actually realised I had put the '.AddVendr' line in the wrong place so I have now moved that and I get pass that stage, however, I am now getting the following error, if either of you have any advice that would be really appreciated.

    enter image description here

    Edit to add - this is a current Umbraco 10 project we are trying to migrate to cloud, so vendr was installed before setting up the cloud project

  • Matt Brailsford 4124 posts 22215 karma points MVP 9x c-trib
    Oct 25, 2022 @ 10:03
    Matt Brailsford
    0

    To be honest, I don't know a lot about cloud. But I'd initially just say have you made sure you have the latest Vendr Deploy package installed?

  • Becky Baker 6 posts 76 karma points
    Oct 25, 2022 @ 10:04
    Becky Baker
    0

    Thanks for the reply. I do have the latest one installed, I actually installed 3.0.1-beta0001 version.

  • Matt Brailsford 4124 posts 22215 karma points MVP 9x c-trib
    Oct 25, 2022 @ 10:33
    Matt Brailsford
    0

    Hmmm, then I'm not entirely sure to be honest as I've never actually attempted converting a project into a cloud solution.

    Is the remote instance updated too? as it seems to be saying its coming from the remote API.

  • Becky Baker 6 posts 76 karma points
    Oct 25, 2022 @ 10:39
    Becky Baker
    0

    It's not converting as such. We have a project we started on in Umbraco 10 but outside of the cloud. No we've created a brand new project in cloud, and moved files over to the standard cloud project that we cloned down (then re-installed dependencies for project). So it's a brand new cloud project but with our code moved over. We've done this for a few other projects so far and it has gone smoothly but none of them had Vendr 3 installed.

  • Philip Hayton 98 posts 435 karma points
    Oct 25, 2022 @ 10:53
    Philip Hayton
    0

    This is a bit of a moonshot but have you tried completely deleting the folder in `/umbraco/deploy/revisions' and then re-running the deploy command from the Umbraco dashboard? From your local solution btw.

    Also make if there are any attributes in your cloud environment it may be worth deleting them if you can get away with it.

  • Becky Baker 6 posts 76 karma points
    Oct 26, 2022 @ 13:55
    Becky Baker
    0

    Hi Matt and Philip

    First, just want to apologise, I read this original post slightly wrong, the error I was getting was Sqlite not SqlClient.

    I managed to solve this by uninstalling Vendr Deploy, running the project so that it would build and we could migrate stuff over from our old SqlServer database, and then reinstalled deploy and it all worked fine.

    Thanks again for the help and advice from you both, and sorry to have accidentally jumped onto a thread about something slightly different!

Please Sign in or register to post replies

Write your reply to:

Draft