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

Fetch Failed: Cannot read property 'isUpdatable' of undefined #526

Closed
dimlau opened this issue Apr 28, 2016 · 21 comments
Closed

Fetch Failed: Cannot read property 'isUpdatable' of undefined #526

dimlau opened this issue Apr 28, 2016 · 21 comments

Comments

@dimlau
Copy link

dimlau commented Apr 28, 2016

When I Check for Updates……

TypeError: Cannot read property 'isUpdatable' of undefined
at e.value (http://xxx/user/plugins/admin/themes/grav/js/admin.min.js?c861a4d78a:4:3340)
at n. (http://xxx/user/plugins/admin/themes/grav/js/admin.min.js?c861a4d78a:4:7031)
at n.emit (http://xxxx/user/plugins/admin/themes/grav/js/admin.min.js?c861a4d78a:3:30430)
at http://xxxx/user/plugins/admin/themes/grav/js/admin.min.js?c861a4d78a:1:3273

@rhukster
Copy link
Member

What version of Grav is this? What other plugins do you have installed?

@dimlau
Copy link
Author

dimlau commented Apr 28, 2016

sorry.
Just installed the new beta 1, I haven't installed any plugins except " Pagination"

@rhukster
Copy link
Member

ok thanks we'll look at this today.

@rhukster rhukster added the bug label Apr 28, 2016
@rhukster
Copy link
Member

BTW, can you post your user/config/system.yaml file?

@w00fz
Copy link
Member

w00fz commented Apr 28, 2016

I need more informations to understand this issue. Could you explain step by step what you did? What version of grav you were on, what did you try to do and if you are able to reproduce this again?
The latest beta is beta.2, btw.

@dimlau
Copy link
Author

dimlau commented Apr 29, 2016

Yes I'm using beta 2 now and it has not improved.
Once I log in to the Admin Panel, it shows up, so I turned off 'Automatically check for updates' in the setting page of plugin Admin Panel. And then if I don't click the 'Check for Updates' button, everything seems ok.

see this

user/config/system.yaml file:

absolute_urls: false
timezone: Asia/Shanghai
param_sep: ':'
wrapped_site: false
reverse_proxy_setup: false
languages:
  include_default_lang: true
  translations: true
  translations_fallback: true
  session_store_active: false
  http_accept_language: false
  override_locale: false
home:
  alias: /home
  hide_in_urls: true
pages:
  theme: medium
  order:
    by: default
    dir: asc
  list:
    count: 20
  dateformat:
    default: 'Y-m-d H:i'
    short: 'jS M Y'
    long: 'D, d M Y G:i:s'
  publish_dates: true
  process:
    markdown: true
    twig: true
  twig_first: false
  events:
    page: true
    twig: true
  markdown:
    extra: true
    auto_line_breaks: false
    auto_url_links: false
    escape_markup: false
    special_chars:
      '>': gt
      '<': lt
  types:
    - txt
    - xml
    - html
    - htm
    - json
    - rss
    - atom
  expires: 604800
  last_modified: true
  etag: true
  vary_accept_encoding: true
  redirect_default_route: false
  redirect_default_code: '301'
  redirect_trailing_slash: true
  ignore_files:
    - .DS_Store
  ignore_folders:
    - .git
    - .idea
  ignore_hidden: true
  url_taxonomy_filters: true
  frontmatter:
    process_twig: false
    ignore_fields:
      - form
  markdown_extra: false
cache:
  enabled: true
  check:
    method: file
  driver: auto
  prefix: g
  lifetime: 604800
  gzip: false
twig:
  cache: true
  debug: true
  auto_reload: true
  autoescape: false
  undefined_functions: true
  undefined_filters: true
  umask_fix: false
assets:
  css_pipeline: false
  css_pipeline_include_externals: true
  css_pipeline_before_excludes: true
  css_minify: true
  css_minify_windows: false
  css_rewrite: true
  js_pipeline: false
  js_pipeline_include_externals: true
  js_pipeline_before_excludes: true
  js_minify: true
  enable_asset_timestamp: false
  collections:
    jquery: 'system://assets/jquery/jquery-2.x.min.js'
errors:
  display: false
  log: true
debugger:
  enabled: false
  shutdown:
    close_connection: true
  twig: true
images:
  default_image_quality: 77
  cache_all: false
  cache_perms: '0755'
  debug: false
media:
  enable_media_timestamp: false
  upload_limit: 0
session:
  enabled: true
  timeout: 1800
  name: kaixin
  secure: false
  httponly: true
gpm:
  releases: testing

One more thing:

here is grav.log file in /logs:

[2016-04-28 21:57:29] grav.NOTICE: Invalid slug set in YAML frontmatter:  =>  [] []
[2016-04-28 22:03:10] grav.CRITICAL: Call to a member function filter() on null - Trace: #0 /home/wwwroot/kaixin/vendor/filp/whoops/src/Whoops/Run.php(363): Whoops\Run->handleError(1, 'Call to a membe...', '/home/wwwroot/k...', 478) #1 [internal function]: Whoops\Run->handleShutdown() #2 {main} [] []
[2016-04-28 22:03:20] grav.CRITICAL: Call to a member function filter() on null - Trace: #0 /home/wwwroot/kaixin/vendor/filp/whoops/src/Whoops/Run.php(363): Whoops\Run->handleError(1, 'Call to a membe...', '/home/wwwroot/k...', 478) #1 [internal function]: Whoops\Run->handleShutdown() #2 {main} [] []
[2016-04-28 22:08:31] grav.CRITICAL: Call to a member function filter() on null - Trace: #0 /home/wwwroot/kaixin/vendor/filp/whoops/src/Whoops/Run.php(363): Whoops\Run->handleError(1, 'Call to a membe...', '/home/wwwroot/k...', 478) #1 [internal function]: Whoops\Run->handleShutdown() #2 {main} [] []
[2016-04-28 22:53:38] grav.NOTICE: Invalid slug set in YAML frontmatter:  =>  [] []
[2016-04-28 22:53:56] grav.NOTICE: Invalid slug set in YAML frontmatter:  =>  [] []
[2016-04-28 22:54:21] grav.NOTICE: Invalid slug set in YAML frontmatter:  =>  [] []
[2016-04-28 22:54:43] grav.NOTICE: Invalid slug set in YAML frontmatter:  =>  [] []
[2016-04-28 22:54:45] grav.NOTICE: Invalid slug set in YAML frontmatter:  =>  [] []
[2016-04-28 22:56:04] grav.NOTICE: Invalid slug set in YAML frontmatter:  =>  [] []
[2016-04-28 22:56:18] grav.NOTICE: Invalid slug set in YAML frontmatter:  =>  [] []
[2016-04-28 22:56:41] grav.NOTICE: Invalid slug set in YAML frontmatter:  =>  [] []
[2016-04-28 23:13:19] grav.NOTICE: Invalid slug set in YAML frontmatter:  =>  [] []
[2016-04-29 03:17:12] grav.CRITICAL: Undefined index: HTTP_USER_AGENT - Trace: #0 /home/wwwroot/kaixin/user/plugins/login/classes/Controller.php(408): Whoops\Run->handleError(8, 'Undefined index...', '/home/wwwroot/k...', 408, Array) #1 /home/wwwroot/kaixin/user/plugins/login/classes/Controller.php(75): Grav\Plugin\Login\Controller->rememberMe() #2 /home/wwwroot/kaixin/user/plugins/login/login.php(103): Grav\Plugin\Login\Controller->__construct(Object(Grav\Common\Grav), '') #3 /home/wwwroot/kaixin/vendor/pimple/pimple/src/Pimple/Container.php(113): Grav\Plugin\LoginPlugin->Grav\Plugin\{closure}(Object(Grav\Common\Grav)) #4 /home/wwwroot/kaixin/user/plugins/login/classes/Login.php(42): Pimple\Container->offsetGet('user') #5 /home/wwwroot/kaixin/user/plugins/login/login.php(132): Grav\Plugin\Login\Login->__construct(Object(Grav\Common\Grav)) #6 [internal function]: Grav\Plugin\LoginPlugin->initialize(Object(RocketTheme\Toolbox\Event\Event), 'onPluginsInitia...', Object(RocketTheme\Toolbox\Event\EventDispatcher)) #7 /home/wwwroot/kaixin/vendor/symfony/event-dispatcher/EventDispatcher.php(181): call_user_func(Array, Object(RocketTheme\Toolbox\Event\Event), 'onPluginsInitia...', Object(RocketTheme\Toolbox\Event\EventDispatcher)) #8 /home/wwwroot/kaixin/vendor/symfony/event-dispatcher/EventDispatcher.php(46): Symfony\Component\EventDispatcher\EventDispatcher->doDispatch(Array, 'onPluginsInitia...', Object(RocketTheme\Toolbox\Event\Event)) #9 /home/wwwroot/kaixin/vendor/rockettheme/toolbox/Event/src/EventDispatcher.php(23): Symfony\Component\EventDispatcher\EventDispatcher->dispatch('onPluginsInitia...', Object(RocketTheme\Toolbox\Event\Event)) #10 /home/wwwroot/kaixin/system/src/Grav/Common/Grav.php(298): RocketTheme\Toolbox\Event\EventDispatcher->dispatch('onPluginsInitia...', NULL) #11 /home/wwwroot/kaixin/system/src/Grav/Common/Processors/PluginsProcessor.php(11): Grav\Common\Grav->fireEvent('onPluginsInitia...') #12 /home/wwwroot/kaixin/system/src/Grav/Common/Grav.php(123): Grav\Common\Processors\PluginsProcessor->process() #13 /home/wwwroot/kaixin/system/src/Grav/Common/Grav.php(385): Grav\Common\Grav->Grav\Common\{closure}() #14 [internal function]: Grav\Common\Grav::Grav\Common\{closure}('plugins', 'Plugins', Object(Closure)) #15 /home/wwwroot/kaixin/system/src/Grav/Common/Grav.php(361): call_user_func_array(Object(Closure), Array) #16 /home/wwwroot/kaixin/system/src/Grav/Common/Grav.php(124): Grav\Common\Grav->__call('measureTime', Array) #17 /home/wwwroot/kaixin/system/src/Grav/Common/Grav.php(124): Grav\Common\Grav->measureTime('plugins', 'Plugins', Object(Closure)) #18 /home/wwwroot/kaixin/index.php(37): Grav\Common\Grav->process() #19 {main} [] []
[2016-04-29 10:32:32] grav.NOTICE: Invalid slug set in YAML frontmatter:  =>  [] []
[2016-04-29 10:42:55] grav.CRITICAL: Call to a member function filter() on null - Trace: #0 /home/wwwroot/kaixin/vendor/filp/whoops/src/Whoops/Run.php(363): Whoops\Run->handleError(1, 'Call to a membe...', '/home/wwwroot/k...', 478) #1 [internal function]: Whoops\Run->handleShutdown() #2 {main} [] []

PS. grav.CRITICAL: Call to a member function filter() on null shows up when I try to add some plugins or themes use the button:

@flaviocopes
Copy link
Contributor

Mmm.. could be some connectivity issue. Do you have access to the command line? If so, try running bin/gpm index. Do you see the plugins list, or an error?

@dimlau
Copy link
Author

dimlau commented Apr 30, 2016

@flaviocopes
Copy link
Contributor

Does this happen again? I've never been able to replicate.

@qasimk2
Copy link

qasimk2 commented Jul 14, 2016

grav_error

This is happening to me using php7, ubuntu 16.04, grav 1.1 rc3.

The error message is

Fetch Failed: undefined is not an object (evaluating 't.isUpdatable')

@flaviocopes flaviocopes self-assigned this Jul 15, 2016
@flaviocopes
Copy link
Contributor

I think the JS needs to be a bit more conservative and handle the error before it escalates to this isUpdatable issue, on it

@w00fz
Copy link
Member

w00fz commented Jul 15, 2016

The problem is on the PHP side we assume this is always fine. The payload should contain a proper error json so that the JS can see it and display it, giving more details about what's going on.

As you changed it now, it will just silently hide the issue which I think is not the right behavior.

grav-plugin-admin/admin.php

Lines 517 to 545 in 5852eb5

try {
$gpm = new GPM($flush);
switch ($action) {
case 'getUpdates':
$resources_updates = $gpm->getUpdatable();
if ($gpm->grav != null) {
$grav_updates = [
"isUpdatable" => $gpm->grav->isUpdatable(),
"assets" => $gpm->grav->getAssets(),
"version" => GRAV_VERSION,
"available" => $gpm->grav->getVersion(),
"date" => $gpm->grav->getDate(),
"isSymlink" => $gpm->grav->isSymlink()
];
echo json_encode([
"status" => "success",
"payload" => [
"resources" => $resources_updates,
"grav" => $grav_updates,
"installed" => $gpm->countInstalled(),
'flushed' => $flush
]
]);
} else {
echo json_encode(["status" => "error", "message" => "Cannot connect to the GPM"]);
}
break;

I would love to know when you guys get that error, what's in the response payload. If you could inspect via Chrome the network panel, see what's in the Response and paste it here that would be great. Or even just let us know of a consistent way of reproducing this.

@flaviocopes
Copy link
Contributor

@w00fz Yep I think the problem is the good old "Cannot connect to the GPM" as I reproduced it by simply turning off my Wifi connection. I now silenced but I also want to make it so that when it's checking automatically, no annoying error pops up. When you click the "Check for updates" button, an error shows up telling it cannot reach the GPM.

Could not distinguish the 2 cases now.

@fourroses666
Copy link

fourroses666 commented Sep 8, 2016

Have this message too on a clean install.
Does it have to do with: JakeChampion/fetch#310 ?

Hmm Chrome has it too.

Fetch Failed:
NetworkError when attempting to fetch resource.

@flaviocopes
Copy link
Contributor

@fourroses666
Copy link

fourroses666 commented Sep 10, 2016

Thanks for the suggestions.
OpenSSL and cURL are enabled, no proxy, tried CHMOD 775 / 664, groupuser is the same for all files. Cleared browser cookies. Can't seem to get the message being removed.

I have no SSH option because I'm on a shared host.

@andrearicci
Copy link

same problem here - fresh install -
Grav v1.1.8 - Admin v1.2.4 - php 5.6.24
anytime I log to admin/dashboard then switch to any page or to dashboard again, I get the error
cattura

@flaviocopes
Copy link
Contributor

And none of the solutions proposed in https://learn.getgrav.org/troubleshooting/common-problems#cannot-connect-to-the-gpm work?

@andrearicci
Copy link

I have both curl and openssl, I have no idea if there is a proxy on my host. Furthermore, I now suffer of difficulties to connect from home - I got the message "the connection was refused - server may be busy or overloaded..." and I have to keep trying until I get in. Is this related to the other connection problem?

@andrearicci
Copy link

I talked with my host assistance, the problem seem to be Zend Opcache, that I had to disable adding the line
php_flag opcache.enable Off
on my .htaccess file
Everything seems to work properly after a bit of testing.
Thank you

@w00fz
Copy link
Member

w00fz commented Dec 8, 2016

Glad you were able to resolve this!

I'm also closing this issue due from inactivity from the topic author, assuming the issue has been resolved. Feel free to reopen if otherwise.

@w00fz w00fz closed this as completed Dec 8, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

7 participants