magento2 – Why is backend javascript showing 404 errors, only in Production Mode?

I am running Magento 2.4.2 on Nginx. Everything works fine until I switch to production mode. In production mode the entire backend becomes unusable because none of the javascript loads, showing 404 errors. I have run all the suggestions I could fine but none have worked so far. Here is my static block in NGINX:

location /static/ {
    # Uncomment the following line in production mode
    expires max;

    # Remove signature of the static files that is used to overcome the browser cache
    location ~ ^/static/version {
        rewrite ^/static/(versiond*/)?(.*)$ /static/$2 last;
    }

    location ~* .(ico|jpg|jpeg|png|gif|svg|js|css|swf|eot|ttf|otf|woff|woff2|html|json)$ {

        set $cors_origin "";

        if ($http_origin ~ '^https://(cdn.mywebsite.com|www.mywebsite.com)$') {
            set $cors_origin $http_origin;
        }

        if ($request_method = 'OPTIONS') {
            add_header Access-Control-Allow-Origin $cors_origin always;
            add_header Access-Control-Allow-Methods 'POST, GET, OPTIONS' always;
            add_header Access-Control-Allow-Headers 'Accept,Authorization,Cache-Control,Content-Type,DNT,If-Modified-Since,Keep-Alive,Origin,User-Agent,X-Requested-With,X-Cache-Hash' always;
            ### Tell client that this pre-flight info is valid for 20 days
            add_header Access-Control-Max-Age 1728000;
            add_header Content-Type 'text/plain charset=UTF-8';
            add_header Content-Length 0;
            return 204;
        }

        add_header 'Access-Control-Allow-Origin' $cors_origin always;

        add_header Cache-Control "public";
        add_header X-Frame-Options "SAMEORIGIN";
        expires +1y;

        if (!-f $request_filename) {
            rewrite ^/static/(versiond*/)?(.*)$ /static.php?resource=$2 last;
        }
    }
    location ~* .(zip|gz|gzip|bz2|csv|xml)$ {
        add_header Cache-Control "no-store";
        add_header X-Frame-Options "SAMEORIGIN";
        expires    off;

        if (!-f $request_filename) {
           rewrite ^/static/(versiond*/)?(.*)$ /static.php?resource=$2 last;
        }
    }
    if (!-f $request_filename) {
        rewrite ^/static/(versiond*/)?(.*)$ /static.php?resource=$2 last;
    }
    add_header X-Frame-Options "SAMEORIGIN";
}

When I switch back to Developer mode it works perfectly. Any help will be much appreciated.

networking – Connecting to password protected samba on Dolphin errors, `Connection to host 192.168.11.1 is broken.`

I am trying to connect to a samba. Apparently I was given a username and password, and that according to tutorials, that if I merely place this in, I should be prompted with a username and password prompt. None comes up, and only this appears:
enter image description here
If I try to put the username and password in manually, the same error applies.

How can I connect to this samba share with Dolphin? What is the error telling me?
Thanks.

Google mobile usability errors – resources blocked by robots.txt

The blocked resources are not generally a problem. These messages are just informational most of the time. These messages are not why your site is deemed to be mobile unfriendly since they are not included in the test. In fact, you can just plain ignore blocked resources unless they are not intended to be blocked. Since you are running WP and these are in /wp-content and /wp-contains folders, these are likely blocked by design and not a problem for you to fix.

You want to log into your Google Webmaster Tools (search console) account and migrate to Search Traffic -> Mobile Usability. At the bottom of this page, you will see a short list of issues found. To the right, you will see a button with >>. Click each one one at a time. You will see a list of pages that have failed the mobility test. Often, these have failed for the same reasons. Click any of the pages. You will see several options including Check Live Version Fix the page and use this option to test if your fix passes the test. Do this for a same set of pages. You will likely find that you only have a few minor things that effect all of these pages and that a few quick fixes can solve your problems. Work through enough of the various pages to get a good feel of what errors you have and that you have indeed fixed your problems. You will not likely have to test all of the pages- just a good sample.

When fixing this problem, you will not be working with your robots.txt file, but rather HTML and your CSS (style) file. Most of your work will likely be in your CSS file.

move – Inconsistent Errors Moving Files using Site Contents and Settings

This is driving me batty.

I’m moving a large quantity of files (documents – .doc, .pdf, .xls) from one subsite to another in Sharepoint 2013. Since we want to preserve the metadata, I’m doing so via Site Contents and Structure (checking files and selecting Actions > Move). It runs smoothly for a while, then I start getting this error. Sometimes simply reloading or trying again will work, sometimes I have to log out or clear my cache, sometimes switching browsers, sometimes just moving on to a different folder.. until eventually I get the error every time. But if I wait several hours, it will start working again. Every time I think I’ve figured out what’s causing the error (file size too large, destination folder too full, something in my cache…), something happens to toss that theory out the window. I’ve googled extensively and not found anything useful. Please help.

Despite being inconsistently triggered, the error itself is the same each time.

The current operation could not be completed. Try again, or contact your system administrator.

Object reference not set to an instance of an object.

You may re-try the operation, and you may need to clean up the half-created data first before re-trying. If the problem persists, please contact your system administrator.

Correlation ID: b1d45b9e-0eab-a03a-1c95-1245c7894e01

Date and Time: 4/9/2018 10:55:16 AM

<error><message>Object reference not set to an instance of an object.</message><full>System.NullReferenceException: Object reference not set to an instance of an object. at  
Microsoft.SharePoint.Library.SPRequest.GetFileAndFolderProperties(String bstrUrl, String bstrStartUrl, ListDocsFlags ListDocsFlags, Boolean bThrowException, Int32&amp; phrStatus, Object&amp; pvarFiles, Object&amp; pvarDirs, UInt32&amp; pdwNumberOfFiles, UInt32&amp; pdwNumberOfDirs) at 
Microsoft.SharePoint.SPWeb.GetFileOrFolderProperties(String strUrl, ListDocsFlags listDocsFlags, Boolean throwException, SPBasePermissions&amp; permMask) at Microsoft.SharePoint.SPFolder.PropertiesCore(Boolean throwException) at Microsoft.SharePoint.SPFolder.ThrowIfNullProperties() at Microsoft.SharePoint.SPFolder.get_WelcomePage() at Microsoft.SharePoint.Publishing.Internal.WebControls.SMPickerValidator.SMValidateMove(ObjectSerializer sourceObj) at 
Microsoft.SharePoint.Publishing.Internal.WebControls.SMPickerValidator.ValidateObjects(ObjectSerializer sourceObject, ObjectSerializer targetObject, Boolean validateType, Boolean validateBranch, Boolean validateMove) at Microsoft.SharePoint.Publishing.Internal.WebControls.SMPickerValidator.ValidateOperation(SPSite contextSite, String() sourceSmtObjectIds, String targetObjectId, Boolean validateType, Boolean validateBranch, Boolean validateMove) at 
Microsoft.SharePoint.Publishing.Internal.WebControls.MoveItems.IsValidMove() at Microsoft.SharePoint.Publishing.Internal.WebControls.MoveItems.DoWork() at Microsoft.Office.Server.Diagnostics.FirstChanceHandler.ExceptionFilter(Boolean fRethrowException, TryBlock tryBlock, FilterBlock filter, CatchBlock catchBlock, FinallyBlock finallyBlock)</full><customData></customData></error>

Getting errors on SPFx hello world web part in SharePoint 2016 referencing a “strings” file

I am trying to get a hello world web part to work in SharePoint 2016.

I believe the SharePoint server has Feature Pack 2 installed as I see that KB4484255 (version 16.0.4966.100) shows as installed which is the February 2020 update.

enter image description here

My understanding is that I need KB4092459 (version 16.0.474.1000), but that the more recent update above is a cumulative update. However, I’m not certain of that, so maybe that’s where I have things wrong.

My dev environment looks like:

  • node v6.10.3 (using nvm)
  • @microsoft/generator-sharepoint@1.1.0 (globally installed)
  • npm@3.10.10 (globally installed)
  • yo@1.8.5 (globally installed)

I chose no JavaScript framework and just used the code out of the box. The web part works in the workbench. I made no code changes after running the Yeoman generator other than updating the write-manifests.json file to have a URL to my cdnBasePath set to an Azure container URL. I also updated deploy-azure-storage.json, but that doesn’t appear to be working as I manually copied the resulting dist files to the container. The dist files are:

  • 7be2dcde-e1b3-4643-804f-26a2458ca04f.manifest.json
  • hello-world.bundle.js
  • hello-world.bundle.js.map

I did a “bundle –ship” and “package-solution –ship”. And uploaded the sppkg file to my SP2016 app catalog. It showed Yes for Enabled, Valid App Package, and Deployed in the app catalog.

I added the app to my test site. It took several minutes for that to complete. I tried manually running the App Installation Service timer job from Central Admin hoping it would help (I don’t know if it did).

I created a test page and tried to add the web part. I looked for the web part under the “Under Development” category and it was not there. A couple of hours later I deployed a totally different hello world web part (different name and description – created via the Yeoman generator) and then this web part finally showed up in the “Under Development” category. I don’t know if one triggered the other.

Upon adding the web part to the page I get an error:

***ERROR MESSAGE:
***Failed to load component “7be2dcde-e1b3-4643-804f-26a2458ca04f” (HelloWorldWebPart). Original error: ***Failed to load URL
‘https://.blob.core.windows.net/helloworld-webpart/helloworld-webpart-helloworldstrings_en-us_536e65149b0acf4d52c0043073b9fc59.js’
for resource ‘helloWorldStrings’ in component
‘7be2dcde-e1b3-4643-804f-26a2458ca04f’ (HelloWorldWebPart). There was
a network problem. This may be a problem with a HTTPS certificate.
Make sure you have the right certificate.

I don’t have a helloworld-webpart-helloworldstrings_en-us_536e65149b0acf4d52c0043073b9fc59.js file in my dist folder. Any idea how I should generate it or otherwise fix this issue?

UPDATE:

I have also tried the same thing using the following for my dev environment:

  • node v8.17.0 (using nvm)
  • @microsoft/generator-sharepoint@1.9.1 (globally installed)
  • npm@3.10.10 (globally installed)
  • windows-build-tools@5.2.2 (globally installed)
  • yo@1.8.5 (globally installed)

I don’t know if the build tools are required. I get the same error as my first environment further above looking for a strings file.

I could not find a Latex character sheet code for 5e D&D that would work without errors

I’m looking for a Latex code for 5e D&D character sheet because there is not enough room for equipment in the original.

I found some but they did not execute well so I’m looking for one that looks just like the D&D beyond. My idea is a working latex code with a clear equipment section that I can easily copy paste for another page just for equipment. Please let me know if something like that exists.

If not, I’d like a latex code for the D&D beyond and would try to change it myself.

Google search console errors after 301 redirect

I’ve just implemented a 301 redirect from a old (bad) website to a new domain with a new design. 1 day after the redirect I’m getting mobile usability errors in google search console. Errors like text to small to read, content wider than screen etc.

Previously I’ve had none of these errors so I’m wondering if this is expected behaviour or should I be worried?

Google rankings have also dropped slightly since I got these errors.

8 – Site broken with multiple errors

I am trying to install a Drupal site locally on a new laptop that was working fine on the old one. I get the following errors.

Notice: Undefined offset: 2 in DrupalCoreDatabaseDatabase::parseConnectionInfo() (line 215 of /var/www/html/docroot/core/lib/Drupal/Core/Database/Database.php)

Notice: Undefined index: driver in DrupalCoreDatabaseDatabase::openConnection() (line 367 of /var/www/html/docroot/core/lib/Drupal/Core/Database/Database.php).

DrupalCoreDatabaseDriverNotSpecifiedException: Driver not specified for this database connection: default in DrupalCoreDatabaseDatabase::openConnection() (line 368 of /var/www/html/docroot/core/lib/Drupal/Core/Database/Database.php).

It’s running inside Docker, PHP version is 7.3.27 and Drupal version 8.9.

How to use Yeoman Generator to generate a SharePoint 2016 SPFx web part (without errors)

I need to create an SPFx web part for SharePoint 2016. I have been following the instructions here but am getting an error when running “yo @microsoft/sharepoint”.

I know that versions of packages really matter, so let me describe those:

  • node v8.17.0 (using nvm)
  • @microsoft/generator-sharepoint@1.0.2 (globally installed)
  • gulp@3.9.1 (globally installed)
  • npm@3.10.10 (globally installed)
  • yo@2.0.0 (globally installed)

After having trouble the first time, I tried my best to replicate everything Vesa had in the video at the link further above. Everything is exactly as his versions show except he doesn’t mention his version of node. I read that it had to be 8.x for SP2016 web parts, so I chose the latest 8.x version (8.17.0).

Getting npm to use 3.10.10 was actually a little bit of work best described here.

When running “yo @microsoft/sharepoint” I chose “No JavaScript web framework” just to keep things simple (although I want React). The first error I get is the following (there are a few other errors after this one).

Downloading binary from
https://github.com/sass/node-sass/releases/download/v3.13.1/win32-x64-57_binding.node
Cannot download
“https://github.com/sass/node-sass/releases/download/v3.13.1/win32-x64-57_binding.node”:

HTTP error 404 Not Found

Going to that web page they clearly don’t keep versions that old. Is there any recommended set of versions for node and npm packages I should use? Are there workarounds I should be using instead to fix this specific issue?

c# – How to handle validation errors from API response when using repository pattern

I’ve got the following:

Clientside C# application. Contains forms for CRUD operations. It uses an API for all data operations.
Input is validated on the client, and obviously also on the server (API).

I use the repository pattern for calling my API. That’s because I want to communicate with data layers via interfaces, and want to be able to have multiple data sources for one repository interface. Like:

ICustomerRepository 
  - bool CreateCustomer(Customer customer);
  - Customer GetCustomer(int id);
  - bool UpdateCustomer(Customer customer);
  - bool DeleteCustomer(int id);

APICustomerRepository : ICustomerRepository 

DatabaseCustomerRepository : ICustomerRepository

So far the context of the question.

When the API is called by the client, and a validation error would occur (or maybe some server error that is put in the response data), the errors have to be handled on the client.
API responses are JSON, and when it’s an error response, it’s a JSON structure like {name: "Name is required"}.
The point is: what is the best approach to give those errors back to the code that uses my repository classes.

As you can see, I return boolean values from repository methods which indicate success/failure.
I would like to not just return a success/fail bool, but the actual errors that came via the API response.
So, I could change the design and modify the method signatures to return a collection of errors. But the problem is, that ‘read’ operations like GetCustomer(int id) already need their return value to return the actual data on success. The return value of the method cannot be used for error handling anymore.

Solutions I can think of:

  1. Throw exceptions for everything. But this seems ugly. Because in my understanding there’s a distinction between exceptional errors (like no internet connection while calling API, or API server is down), and non exceptional errors (like just wrong input that somehow slipped through the clientside input validation). Although the non-exceptional errors I mention are rare, and would theoretically never occur on the serverside validation.

  2. Wrapping the data (return value) of repository methods in a wrapper object, that can also contain a collection of error messages.

  3. After API response that indicates failure (and thus contains the error messages), save the messages in a class property of the repository class, and the code thet uses the repository has to check explicitly if there are errors stored in that class. (Seems to be ugly too).

What’s the best or most common approach?