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 package randomly load old files #3199

Closed
abrahamgr opened this Issue Jan 3, 2019 · 14 comments

Comments

Projects
None yet
5 participants
@abrahamgr
Copy link

abrahamgr commented Jan 3, 2019

I have an app deployed to some tenants but only in one tenant I have this issue, it loads the old js files (90% of the times), I have enabled include "includeClientSideAssets": true and the CDN is not enabled.

When I check the ClientSideAssets library the files are there but the reference is other ones, I have some webparts and extensions and it happens in both but not for all. I tried cleaning the files using gulp clean, increasing the app version, re-adding the app and webparts to the site and the issue still persists.
This is strange because it's only in this tenant and I'm not allowed to enable CDN.

***INNERERROR:
***Failed to load URL 'https://[sometenant].sharepoint.com/sites/ENT-AppStore/ClientSideAssets/61e48f50-b55f-41f9-9d42-1d20ea7249f2/create-requests-web-part_07e874fed1dbf040304ad52b8e8ada90.js' for resource 'create-requests-web-part' in component 'f3e02969-964c-4ad3-aa35-e5e6ec55047c' (CreateRequestsWebPart). The file was not found in the server.

Additional information: I have multiple features to enable the extensions and one feature to enable the webparts, I have configured the componentIds for each feature.

Category

  • Question
  • Typo
  • Bug
  • Additional article idea

Expected or Desired Behavior

Always get the latest files deployed.

Observed Behavior

Sometimes loads correctly with the latest files but other times the files weren't found because the id in the files is an old one.

Steps to Reproduce

  1. Deploy the app
  2. Install the app in the site
  3. Add the webparts
@msft-github-bot

This comment has been minimized.

Copy link
Collaborator

msft-github-bot commented Jan 3, 2019

Thank you for reporting this issue. We will be triaging your incoming issue as soon as possible.

@patmill

This comment has been minimized.

Copy link
Contributor

patmill commented Jan 3, 2019

Can you double check the component manifests list and make sure that there is only one entry with the component ID you expect?

https://[tenant].sharepoint.com/[appCatalogSite]/lists/componentmanifests

@abrahamgr

This comment has been minimized.

Copy link

abrahamgr commented Jan 3, 2019

@patmill There are two items per component, should I delete the old one?

@nikskhubani

This comment has been minimized.

Copy link

nikskhubani commented Jan 3, 2019

Hi @abrahamgr

I think you are suffering same like me. Have a look at this thread:
#3079

The issue was
I created two features in my package-manifest.json and as soon as I use gulp to package solution for me, it adds both webpart and extension element in both features.

How I fixed
I merged both the features and made it one feature.

What about existing customers where the double entries are added
Only deleting one of the component manifest will not fix the issue. You need to make sure, you first delete the app from app catalog site that will clean old entries from component manifests and add the app again with only single feature which will make sure only 1 entry gets added to it and all works as expected.

@abrahamgr

This comment has been minimized.

Copy link

abrahamgr commented Jan 3, 2019

Hi @nikskhubani
I believe that is a different case, when you have more than 1 feature you have to set the components ids in the package-manifest.json if you don't set it, all components will be in one feature, it appears as a warning in the console when you are building. I don't thinks the features are the problem, because it works perfectly in other tenant.
But you case it's similar to mine, I'm still doing some tests, but the threat helps.

@abrahamgr

This comment has been minimized.

Copy link

abrahamgr commented Jan 7, 2019

Thanks for all your comments I solved this removing the duplicated item in the list componentmanifests, I had to update the app with a new version number and double checking the package-solution.json.

For some reason maybe in the old deployments I had wrong the package-solution.json because I have been adding more components, right now it's working and everything is right.

@abrahamgr abrahamgr closed this Jan 7, 2019

@coreyroth

This comment has been minimized.

Copy link

coreyroth commented Jan 7, 2019

Can you post an example of your package-solution.json with a combined feature manifest? I'm having the same issue.

@abrahamgr

This comment has been minimized.

Copy link

abrahamgr commented Jan 7, 2019

Sure @coreyroth, this is my file, just make sure you have the component ids on each feature if you have multiples.

{
  "$schema": "https://developer.microsoft.com/json-schemas/spfx-build/package-solution.schema.json",
  "solution": {
    "name": "Solution Hub",
    "id": "61E48F50-B55F-41F9-9D42-1D20EA7249F2",
    "version": "1.0.0.8",
    "includeClientSideAssets": true,
    "supportedLocales": [
      "en-us"
    ],
    "features": [
      {
        "title": "Solution Hub - Webparts",
        "description": "Deploys the webparts",
        "id": "5e14b052-de92-4dff-bc9b-22494468397b",
        "componentIds": [
          "3d07a405-cf8c-42ad-901c-0a2b618f82af",
          "f3e02969-964c-4ad3-aa35-e5e6ec55047c"
        ]
      },
      {
        "title": "Solution Hub - Header",
        "description": "Deploys an extension that shows a header",
        "id": "de99ed3f-bfbb-42c2-a34e-d7b6e0015b1e",
        "componentIds": [
          "6de0e31b-13d7-4c12-b580-7cebbb0edb53"
        ],
        "assets": {
          "elementManifests": [
            "header.xml"
          ]
        }
      },
      {
        "title": "Solution Hub - Footer",
        "description": "Deploys an extension that shows a footer",
        "id": "d283d24c-1122-4f50-9f48-f7590cf35cb6",
        "componentIds": [
          "e81c10ca-9129-4222-a2ee-e195313867fc"
        ],
        "assets": {
          "elementManifests": [
            "footer.xml"
          ]
        }
      },
      {
        "title": "Solution Hub - Hide commandbar",
        "description": "Hide the commandbar in the pages configured",
        "id": "97b460bc-0deb-40a7-aefd-83b6ad37ddba",
        "version": "1.0.0.0",
        "componentIds": [
          "17ec9754-cee4-41cf-b0f0-e07f174d94aa"
        ],
        "assets": {
          "elementManifests": [
            "hideCommandbar.xml"
          ]
        }
      }
    ]
  },
  "paths": {
    "zippedPackage": "solution/Solution-hub.sppkg"
  }
}
@patmill

This comment has been minimized.

Copy link
Contributor

patmill commented Jan 7, 2019

Just an FYI - we will be adding additional checks on the server to handle this situation in the future.

@coreyroth

This comment has been minimized.

Copy link

coreyroth commented Jan 7, 2019

@abrahamgr It looks like you still have multiple features. One for each of your command set / app customizers. Is it just the fact that you combined the web parts into a single feature that resolved it for you?

@abrahamgr

This comment has been minimized.

Copy link

abrahamgr commented Jan 7, 2019

@patmill Thanks, it will prevent some issues like this.
@coreyroth Yes, it's a requirement for my solution.

@nikskhubani

This comment has been minimized.

Copy link

nikskhubani commented Jan 8, 2019

thanks @patmill , it would be great to have server side validation to avoid mistakes we guys do 👍
@abrahamgr good to hear it and thanks for your suggestions about component ID

@patmill

This comment has been minimized.

Copy link
Contributor

patmill commented Jan 8, 2019

@coreyroth - did you figure out the "how do I get extensions and webparts in the same solution" question? I see that it is deleted from here.

To summarize, you can only have 1 feature in an SPFX solution, but that feature can have any number of webparts and extensions in it. When you run the generator again from your solution folder, simply add another webpart or extension, and it will get added correctly to the solution.

@coreyroth

This comment has been minimized.

Copy link

coreyroth commented Jan 8, 2019

Hi @patmill thanks for checking on me. Yes, I figured it out. I think I originally pasted my component id for the application customizer in incorrectly.

For clarity, how I discovered this issue which has affected our clients is because I added an application customizer to my existing project. When I added the app customizer, the web parts no longer get published. I then guessed at how to add the web parts by creating features for them (obviously that was wrong). I have a repo of an out-of-the-box project that I am going to share later that shows the original issue, because I think it's a problem if simply adding an app customizer to an existing web part project that they no longer get published. Users will need guidance on that. I'm also going to put a post together that summarizes my findings.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment