Jump to content
gebeer

TypeError: a.ProcessPageList is not a function in Admin

Recommended Posts

Hello,

I'm getting a JS error in the admin backend when editing pages with template basic-page as non superuser:
TypeError: a.ProcessPageList is not a function in InputfieldPageListSelect.min.js

Investigating the JS, I found that the ProcessPageList function is not available on the page when I am logged in as a non superuser. 

The function is defined in /wire/modules/Process/ProcessPageList/ProcessPageList.min.js which is not loaded when logged in as non superuser.

When logged in as a superuser, the file gets loaded.

I have no fancy permission settings for that template for the role admin that the non superuser belongs to:

58ddc6a057b72_2017-03-31100110.thumb.png.665b0b9cb36a6de3dbfc971cc997691f.png

This started happening on a site that is in development but online for some time now. I can't say which actions might have caused this. But it is a consistent error only for this one template.

The site is running on 3.0.42

EDIT: The inputfield triggering the error is an image field (in fact there are 2 of them in that template)

Any pointers to potential causes for this problem would be much appreciated. 

EDIT: The problem is not related to any file changes. When I run the same install with a DB backup, the error disappears. So it must be something that has changed in the DB. Trying to diff the DB dumps and see if I can find anything suspicious

Share this post


Link to post
Share on other sites

UPDATE: I couldn't find anything suspicious in the DB dump diff. So after tinkering for a while I decided to try a workaround.

I added a new role and gave it the same template-level permissions as the 'faulty' role that caused the problems. Then I assigned this new role to the admin user with the old, 'faulty' role (in addition to the old one).

And this helped, the JS error is now gone.

Not sure, though, what to make of this. It seems to be pointing to a problem in the settings for that 'faulty' role. But I went through the role and permission settings numerous times and couldn't find anything unusual.

So for now I will let it be as it is. Although I really would like to find the real cause of the problem. Just don't know where else to look for it. Feels a bit uncomfortable to have a site running in production with a strange admin error that might reappear anytime...

So if anyone reading this has an idea, please let me know. But thanks for reading anyways.

  • Like 1

Share this post


Link to post
Share on other sites

Hi @gebeer - I just came across this - one of my site editors gets this error when trying to edit a PageTable or Repeater field that contains images. I haven't investigated much yet, but was wondering if you ever found out anything more on this?

It seemed to come out of the blue, but maybe it was related to a PW core update? What version are you running?

Share this post


Link to post
Share on other sites

@adrian unfortunately I couldn't find the reason for this. My workaround with the new user is still working, though.

The install where the error occured is running on 3.0.42. I can't say if it was related to an update. Really stepping in the dark on this one...

  • Like 1

Share this post


Link to post
Share on other sites
6 minutes ago, gebeer said:

@adrian unfortunately I couldn't find the reason for this. My workaround with the new user is still working, though.

The install where the error occured is running on 3.0.42. I can't say if it was related to an update. Really stepping in the dark on this one...

Thanks - unfortunately creating a new role to assign to the user isn't working for me - I'll take a better look tomorrow and see what I can figure out.

Cheers.

Share this post


Link to post
Share on other sites

I don't have much time to figure out why at the moment, but I discovered that InputfieldPageListSelect::renderReady is not being called for non-superusers. It is inside this that the ProcessPageList module is loaded, so as a quick hack so I can move on for now, I added:

if($page->template->name == 'admin' && $user->isLoggedIn()) $this->wire('modules')->get('ProcessPageList');

to site/ready.php which gets things working properly again.

I hope to find some time to get back to this and investigate properly, but if anyone else has any ideas that would be awesome :)

  • Like 1

Share this post


Link to post
Share on other sites

Hey @gebeer - I just stumbled across this again - do you know if this was ever reported on Github?

I am still using that hack here on a couple of sites, but not sure if it's still needed, so just wondering if you had any more recent info on it.

Share this post


Link to post
Share on other sites
On 3/4/2019 at 10:46 PM, adrian said:

Hey @gebeer - I just stumbled across this again - do you know if this was ever reported on Github?

I am still using that hack here on a couple of sites, but not sure if it's still needed, so just wondering if you had any more recent info on it.

I did not run into this again and it happened only on that one install which has not been upgraded since. So I'm afraid, I can't tell...

  • Like 1

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Recently Browsing   0 members

    No registered users viewing this page.

  • Similar Content

    • By Clément Lambelet
      Hey!
      I've been working on a Processwire installation (3.0.123) for a few days now and I must have made a big mistake this morning because the links in the admin's main menu no longer appear.
      This is not related to the admin theme, because the bug occurs with all themes (Default, Reno, Uikit).
      I tried to reinstall with the dev version (3.0.136), but the problem is still there. I also uninstalled all the modules I had added, without success. There is no error in the js console. 
      I still can access/view/edit the pages  by going through the admin/page list.
      Thanks in advance for your help!


    • By MateThemes
      Hello everyone!
      I have searched the forum for quite a long time and I tried some solutions for my topic but nothing seems to work.
      I need to create a Settings Page and for a native feeling I want to create it under the main navigation on top. The settings page should hold the Main Logo, some styling and other settings. As I said nothing seems to work for me. I tried to create a Page under Admin with Admin Template and ProcessPageEdit but then I can't assign an image field. 
      I don't want to write a module because it is to much work for only 3 settings.
      I hope someone of the forum could help me out!
      Have a nice day!
    • By John Bates
      Which is better Elm or Typescript?
    • By schwarzdesign
      We recently rebuilt the Architekturführer Köln (architectural guide Cologne) as a mobile-first JavaScript web app, powered by VueJS in the frontend and ProcessWire in the backend. Concept, design and implementation by schwarzdesign!
      The Architekturführer Köln is a guidebook and now a web application about architectural highlights in Cologne, Germany. It contains detailled information about around 100 objects (architectural landmarks) in Cologne. The web app offers multiple ways to search through all available objects, including:
      An interactive live map A list of object near the user's location Filtering based on architect, district and category Favourites saved by the user The frontend is written entirely in JavaScript, with the data coming from a ProcessWire-powered API-first backend.
      Frontend
      The app is built with the Vue framework and compiled with Webpack 4. As a learning exercise and for greater customizability we opted to not use Vue CLI, and instead wrote our own Webpack config with individually defined dependencies.
      The site is a SPA (Single Page Application), which means all internal links are intercepted by the Vue app and the corresponding routes (pages) are generated by the framework directly in the browser, using data retrieved from the API. It's also a PWA (Progressive Web App), the main feature of which is that you can install it to your home screen on your phone and launch it from there like a regular app. It also includes a service worker which catches requests to the API and returns cached responses when the network is not available. The Architekturführer is supposed to be taken with you on a walk through the city, and will keep working even if you are completely offline.
      Notable mentions from the tech stack:
      Vue Vue Router for the SPA functionality VueX for state management and storage / caching of the data returned through the API Leaflet (with Mapbox tiles) for the interactive maps Webpack 4 for compilation of the app into a single distributable Babel for transpilation of ES6+ SASS & PostCSS with Autoprefixer as a convenience for SASS in SFCs Google Workbox to generate the service worker instead of writing lots of boilerplate code Bootstrap 4 is barely used here, but we still included it's reboot and grid system Backend
      The ProcessWire backend is API-only, there are no server-side rendered templates, which means the only PHP template is the one used for the API. For this API, we used a single content type (template) with a couple of pre-defined endpoints (url segments); most importantly we built entdpoints to get a list of all objects (either including the full data, or only the data necessary to show teaser tiles), as well as individual objects and taxonomies. The API template which acts as a controller contains all the necessary switches and selectors to serve the correct response in <100 lines of code.
      Since we wanted some flexibility regarding the format in which different fields were transmitted over the api, we wrote a function to extract arbitrary page fields from ProcessWire pages and return them as serializable standard objects. There's also a function that takes a Pageimage object, creates multiple variants in different sizes and returns an object containing their base path and an array of variants (identified by their basename and width). We use that one to generate responsive images in the frontend. Check out the code for both functions in this gist.
      We used native ProcessWire data wherever possible, so as to not duplicate that work in the frontend app. For example:
      Page names from the backend translate to URLs in the frontend in the form of route parameters for the Vue Router Page IDs from ProcessWire are included in the API responses, we use those to identify objects across the app, for example to store the user's favourites, and as render keys for object lists Taxonomies have their own API endpoints, and objects contain their taxonomies only as IDs (in the same way ProcessWire uses Page References) Finally, the raw JSON data is cached using the cache API and this handy trick by @LostKobrakai to store raw JSON strings over the cache API.
      Screenshots














    • By VeiJari
      Hello forum. I'm trying to figure out how to detect if current form has errors after saving it in pw admin page. This is so that our event location isn't added in database if we detect errors. But I can't seem to find a correct way to detect errors? I only found the wire()->errors() and it always triggers even if I don't have any errors. 
      How can I detect errors in a form?
      By error I mean $page->error('this is the red error');
×
×
  • Create New...