Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SPFx app loads random versions when it has been upgraded multiple times #3079

Closed
nikskhubani opened this issue Dec 6, 2018 · 17 comments

Comments

Projects
None yet
4 participants
@nikskhubani
Copy link

commented Dec 6, 2018

We are creating updated versions of SPFx components and testing them in tenant app catalogs. We find that the versions of SPFx extension is randomly loading older version extension properties or javascripts

Category

  • Question
  • Typo
  • Bug
  • Additional article idea

Observed Behavior

When we update the version of the SPPKG app from package-solution.json we sometimes see older version of extension JS loaded

Page some times load older version JS and sometime it loads newer version JS. Atleast 1 out of each 5 refresh you see older version of JS is loaded.

Steps to Reproduce

  1. Create a new SPFx extension and deploy it to the tenant app catalog
  2. Add the app to your site collection
  3. Change the "version": "x.x.x.x" to new higher number in package-solution.json file
  4. Build the bundle and package and deploy to the tenant app catalog
  5. upgrade app in your site content
  6. Refresh any of the page in site multiple times

Expected or Desired Behavior

The page must always load the extension JS version as mentioned in package-solution.json and not randomly

@nikskhubani

This comment has been minimized.

Copy link
Author

commented Dec 6, 2018

@VesaJuvonen we also tried to create tickets with Microsoft Level 1 but since this is kind of product level issue they said they cant help on it so I have to come back here.

I have been asking about this issue since almost 2-3 months in below tickets but this issue is still reproducible easily

#2600
#2329

@patmill

This comment has been minimized.

Copy link
Contributor

commented Dec 6, 2018

So, have you also installed the extension in a site-collection app catalog?
Where is your js script being loaded from?
Does the js file name change from build-to-build?
It's really strange (and I can't think of how it would even be possible) to load an older version. We don't support multiple versions of the package, and the manifest has a single instance in the catalog. The only thing I can think of is that the file name didn't change between versions, and you have a local cache of the file that is getting loaded. However if you are building with the tools and not doing anything strange, there should be a hash-value applied to the file name, so that it gets a new filename every time a build is done (even if you don't bump the version #).

@nikskhubani

This comment has been minimized.

Copy link
Author

commented Dec 6, 2018

Thank you @patmill for quick response

Here are the answers please:

  1. So, have you also installed the extension in a site-collection app catalog?
    No, simply added app first time to tenant app catalog and then upgraded that app with newer version
  2. Does the js file name change from build-to-build?
    No, We made sure it remains same always (short-point-custom-actions-application-customizer.js)
  3. Where is your js script being loaded from?
    Amazon CDN

so from your comments, it looks like having same file name each time is causing the issue? However the URL of the entire JS is different as shown below

"cdnBasePath":"https:///spfx/<version which changes every time for example 6.0.2.2>/spfx/deploy/"

so should it not be enough to make sure the URL is unique and it should not load from cache?

@patmill

This comment has been minimized.

Copy link
Contributor

commented Dec 6, 2018

What is the full path to your js file? That's all the browser is going to care about. In general it's not a great idea to keep the file name the same, as it can result in issues like this.

@nikskhubani

This comment has been minimized.

Copy link
Author

commented Dec 6, 2018

Here is an example of the extension URL
https://d2zzvnmppezkx.cloudfront.net/spfx/6.2.0.20/spfx/deploy/short-point-custom-actions-application-customizer.js
so sometimes it loads older version like
https://d2zzvnmppezkx.cloudfront.net/spfx/**_6.2.0.16_**/spfx/deploy/short-point-custom-actions-application-customizer.js
or
https://d2zzvnmppezkx.cloudfront.net/spfx/**_6.2.0.17_**/spfx/deploy/short-point-custom-actions-application-customizer.js

See this animation, sorry its a big long because its random issue. Now in the animation below you will see that till the end the extension is loaded from 6.2.0.15 version while the installed version is NOT 6.2.0.15, its 6.2.0.20. If you see towards end of this animation (nearly after 2 minutes and 10 seconds), the extension is loaded from 6.2.0.20 version which is correct version.

All I am doing in below animation is refresh page!

old extension loading

@patmill

This comment has been minimized.

Copy link
Contributor

commented Dec 6, 2018

Huh. weirdness. Can you look at the manifest for your extension and paste the content of if here (feel free to redact stuff)?

If you type ctrl+`+F12 you should get the dev tool open. Choose the Manifests tab at the top, and scroll down until you find your component. The manifest for it should appear on the right.

While you are at it, make sure you don't have another component on the page that is pulling from the wrong data.

@nikskhubani

This comment has been minimized.

Copy link
Author

commented Dec 6, 2018

Here you go

{ "extensionType": 2, "version": "0.0.1", "alias": "ShortPointCustomActionsApplicationCustom", "loaderConfig": { "internalModuleBaseUrls": [ "https://d2zzvnmppezkx.cloudfront.net/spfx/6.2.0.20/spfx/deploy/" ], "entryModuleId": "short-point-custom-actions-application-customizer", "scriptResources": { "short-point-custom-actions-application-customizer": { "type": "path", "path": "short-point-custom-actions-application-customizer.js" }, "@microsoft/sp-core-library": { "type": "component", "id": "7263c7d0-1d6a-45ec-8d85-d4d1d234171b", "version": "1.4.1" }, "@microsoft/sp-loader": { "type": "component", "id": "1c6c9123-7aac-41f3-a376-3caea41ed83f", "version": "1.4.1" }, "@microsoft/sp-http": { "type": "component", "id": "c07208f0-ea3b-4c1a-9965-ac1b825211a6", "version": "1.4.1" }, "@microsoft/decorators": { "type": "component", "id": "f97266fb-ccb7-430e-9384-4124d05295d3", "version": "1.4.1" }, "@microsoft/sp-application-base": { "type": "component", "id": "4df9bb86-ab0a-4aab-ab5f-48bf167048fb", "version": "1.4.1" } } }, "manifestVersion": 2, "id": "f5673854-e363-428c-8ab4-5095faec34db", "componentType": "Extension" }

@patmill

This comment has been minimized.

Copy link
Contributor

commented Dec 6, 2018

Just to confirm again - on a page that loads the wrong version, the manifest points to the right one?

If that is the case, when you look at the normal developer tools in the browser and find the network call to load the incorrect js version, what does the callstack of the call look like?

@nikskhubani

This comment has been minimized.

Copy link
Author

commented Dec 6, 2018

Ok, I was able to reproduce it again and here is the manifest look like when its loaded wrongly:

{ "extensionType": 2, "version": "0.0.1", "alias": "ShortPointCustomActionsApplicationCustom", "loaderConfig": { "internalModuleBaseUrls": [ "https://d2zzvnmppezkx.cloudfront.net/spfx/6.2.0.15/spfx/deploy/" ], "entryModuleId": "short-point-custom-actions-application-customizer", "scriptResources": { "short-point-custom-actions-application-customizer": { "type": "path", "path": "short-point-custom-actions-application-customizer.js" }, "@microsoft/sp-core-library": { "type": "component", "id": "7263c7d0-1d6a-45ec-8d85-d4d1d234171b", "version": "1.4.1" }, "@microsoft/sp-loader": { "type": "component", "id": "1c6c9123-7aac-41f3-a376-3caea41ed83f", "version": "1.4.1" }, "@microsoft/sp-http": { "type": "component", "id": "c07208f0-ea3b-4c1a-9965-ac1b825211a6", "version": "1.4.1" }, "@microsoft/decorators": { "type": "component", "id": "f97266fb-ccb7-430e-9384-4124d05295d3", "version": "1.4.1" }, "@microsoft/sp-application-base": { "type": "component", "id": "4df9bb86-ab0a-4aab-ab5f-48bf167048fb", "version": "1.4.1" } } }, "manifestVersion": 2, "id": "f5673854-e363-428c-8ab4-5095faec34db", "componentType": "Extension" }

And the exported traces are attached ones.
spfx_trace_logs.xlsx

@patmill

This comment has been minimized.

Copy link
Contributor

commented Dec 6, 2018

OK, that's really really weird. Should the version #s have changed between those two manifests? Ie, they currently both say "version": "0.0.1", "alias": "ShortPointCustomActionsApplicationCustom"

A couple of other things to look at. Is there any chance that you have multiple solutions uploaded to the apps list? If you go to the component manifest lists ( /sites/{appcatalogname}/Lists/ComponentManifests/ ) do you see multiple entries for your component ID "f5673854-e363-428c-8ab4-5095faec34db" ?

If you feel comfortable, you can mail me at my account @ microsoft.com with a debug account and we can try looking in further.

@nikskhubani

This comment has been minimized.

Copy link
Author

commented Dec 7, 2018

Yes, Yes, Yes!

I see two extension entries in given component manifests list. Do you see this is the issue?

@patmill

This comment has been minimized.

Copy link
Contributor

commented Dec 7, 2018

Well, it's certainly not correct. OK, next step. In that same table, there should be a column (maybe not displayed by default, but you can add it) that states the solution that the component came from. Hopefully they are different IDs. Next, check and see what else is referencing that solution (you should be able to filter the component manifest list on that solution). Make sure that it's OK to delete those, because that's what we're going to do. Next, go to the solution library (the one you upload your packages to) and find the one that the 6.2.0.15 solution pointed to. Delete it. That should remove the entries from the client side component manifests.

@nikskhubani

This comment has been minimized.

Copy link
Author

commented Dec 7, 2018

Just to summarize, you are asking to remove these entries right?

So all 4 entries belong to our SPFx package and the highlighted ones are of older apps which I believe should not be there.

Now the second point of yours, solution library has only 1 solution which is latest (6.2.0.20) as the steps we followed is:

  1. First created a version called 6.2.0.17
  2. added to app catalog and site
  3. all working
  4. Now, we have some changes so we created a new package with same code but version changed to 6.2.0.20

  1. Uploaded the package again to app catalog, now it will ask you to overwrite since there is already 6.1.0.17 installed. So overwrite and deploy.

That's it. So solution gallery would have only 1 app.

@patmill

This comment has been minimized.

Copy link
Contributor

commented Dec 7, 2018

OK, took a look at the solution you sent me and checked out the tenant. The biggest issue is that your package is weird. Really really weird. You have multiple instances of the same components in it, as well as mixing older SharePoint Add-in and SPFx solutions in the same package. How did you wind up with this package?

So, bug in our code to not flat out fail to process your package, but the solution for you will be to create a clean package. SharePoint add-ins need to be separate from SPFX solutions, and your spfx solution should only have 1 copy of each component in it.

@patmill patmill closed this Dec 7, 2018

@nikskhubani nikskhubani referenced this issue Jan 3, 2019

Closed

SPFx package randomly load old files #3199

1 of 4 tasks complete
@coreyroth

This comment has been minimized.

Copy link

commented Jan 7, 2019

Ok, so I am absolutely having this same issue. It used to only affect one tenant and now it's affecting others. I've been chasing this issue for weeks and I have an open ticket with Premier #12352688. I'll check the steps in this article in detail to see how mine compare.

@nikskhubani

This comment has been minimized.

Copy link
Author

commented Jan 8, 2019

There were few mail chain between @patmill and myself, so happy to help you if above doesnt help. Just mail me at nitin@shortpoint.com

@bostonmusicdave

This comment has been minimized.

Copy link

commented Jan 29, 2019

@coreyroth we had the same issue when using site collection app catalogs and found that old versions seemed to exist in the recycle bin each time i'd upgraded the solution in the site collection app catalog. It's worth checking the recycle bin to see if you see old versions in there and try clearing them out

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.