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

Undefined array key "result" #518

Open
4 tasks done
ajmeese7 opened this issue Jun 4, 2024 · 1 comment · May be fixed by #519
Open
4 tasks done

Undefined array key "result" #518

ajmeese7 opened this issue Jun 4, 2024 · 1 comment · May be fixed by #519

Comments

@ajmeese7
Copy link

ajmeese7 commented Jun 4, 2024

New Issue Checklist

Issue Description

PHP throws the following warning whenever I use Parse server:

2024-06-04 17:49:24 NOTICE: PHP message: PHP Warning:  Undefined array key "result" in /code/vendor/parse/php-sdk/src/Parse/ParseCloud.php on line 39

It's not fatal, but I feel like it should be a pretty simple fix to avoid. Seems to be possibly related to #517.

Steps to reproduce

Simplified version of my code:

$httpClient = \Parse\ParseClient::getHttpClient();
$httpClient->setup();
$response = $httpClient->send($fileUrl);

\Parse\ParseCloud::run("coreSavingSourceData", ["sourceId" => $source->getObjectId()], true);
\Parse\ParseCloud::run("sendImportDataToParsers", [
  "sourceId" => $source->getObjectId(),
  "locationId" => $source->get("location")->getObjectId(),
  ...
], true);

foreach ($sourceData as $type => $parseObjects) {
  foreach (array_chunk($parseObjects, BATCH) as $chunk) {
    $source->fetch(true);
    if (!$source->get("isUploadCancelled")) {
      try {
        \Parse\ParseObject::saveAll($chunk, true, BATCH);
      } catch (\Parse\ParseAggregateException $e) {
        $errors = array_map(fn($er) => $er["error"], $e->getErrors());
        error_log(print_r($errors, true));
      }
    } else {
      throw new \Error("Upload cancelled");
	}
  }
}

$source->set("dataoneCount", count($sourceData["dataone"]));
$source->set("datatwoCount", count($sourceData["datatwo"]));
$source->save(true);

Environment

Parse PHP SDK

  • SDK version: 2.3.2
  • PHP version: 8.2

Server

  • Parse Server version: 7.0.0
  • Operating system: php:8.2-fpm Docker container
  • Local or remote host (AWS, Azure, Google Cloud, Heroku, Digital Ocean, etc): Local (Docker)

Database

  • System (MongoDB or Postgres): mongo:6 Docker container
  • Local or remote host (MongoDB Atlas, mLab, AWS, Azure, Google Cloud, etc): Local (Docker)

Logs

2024-06-04 16:23:28 [04-Jun-2024 20:23:28] NOTICE: fpm is running, pid 8
2024-06-04 16:23:28 [04-Jun-2024 20:23:28] NOTICE: ready to handle connections
2024-06-04 17:41:42 NOTICE: PHP message: PHP Warning:  Undefined array key "result" in /code/vendor/parse/php-sdk/src/Parse/ParseCloud.php on line 39
2024-06-04 17:51:20 NOTICE: PHP message: PHP Fatal error:  Uncaught Parse\ParseException: Object not found. in /code/vendor/parse/php-sdk/src/Parse/ParseClient.php:610
2024-06-04 17:51:20 Stack trace:
2024-06-04 17:51:20 #0 /code/vendor/parse/php-sdk/src/Parse/ParseObject.php(561): Parse\ParseClient::_request('GET', 'classes/Source/...', NULL, NULL, true)
2024-06-04 17:51:20 #1 /code/src/Import/baseImporter.php(285): Parse\ParseObject->fetch(true)
2024-06-04 17:51:20 #2 /code/src/Import/ciscoconfig.php(666): PROJECT\Import\baseImporter->saveDataInParse(Array)
2024-06-04 17:51:20 #3 /code/src/Import/baseImporter.php(56): PROJECT\Import\ciscoconfig->import()
2024-06-04 17:51:20 #4 /code/src/Controllers/ImportController.php(49): PROJECT\Import\baseImporter->__construct(Array, Object(Pimple\Container))
2024-06-04 17:51:20 #5 /code/index.php(29): PROJECT\Controllers\ImportController->processRequest()
2024-06-04 17:51:20 #6 {main}
2024-06-04 17:51:20   thrown in /code/vendor/parse/php-sdk/src/Parse/ParseClient.php on line 610
2024-06-04 17:51:20 127.0.0.1 -  04/Jun/2024:21:41:41 +0000 "POST /index.php" 200
2024-06-04 17:51:20 NOTICE: PHP message: Uncaught Parse\ParseException: Object not found. in /code/vendor/parse/php-sdk/src/Parse/ParseClient.php:610
2024-06-04 17:51:20 Stack trace:
2024-06-04 17:51:20 #0 /code/vendor/parse/php-sdk/src/Parse/ParseObject.php(561): Parse\ParseClient::_request('GET', 'classes/Source/...', NULL, NULL, true)
2024-06-04 17:51:20 #1 /code/src/Import/baseImporter.php(285): Parse\ParseObject->fetch(true)
2024-06-04 17:51:20 #2 /code/src/Import/ciscoconfig.php(666): PROJECT\Import\baseImporter->saveDataInParse(Array)
2024-06-04 17:51:20 #3 /code/src/Import/baseImporter.php(56): PROJECT\Import\ciscoconfig->import()
2024-06-04 17:51:20 #4 /code/src/Controllers/ImportController.php(49): PROJECT\Import\baseImporter->__construct(Array, Object(Pimple\Container))
2024-06-04 17:51:20 #5 /code/index.php(29): PROJECT\Controllers\ImportController->processRequest()
2024-06-04 17:51:20 #6 {main}
2024-06-04 17:51:20   thrown
2024-06-04 17:51:20 NOTICE: PHP message: PHP Fatal error:  Uncaught Parse\ParseException: Object not found. in /code/vendor/parse/php-sdk/src/Parse/ParseClient.php:610
2024-06-04 17:51:20 Stack trace:
2024-06-04 17:51:20 #0 /code/vendor/parse/php-sdk/src/Parse/ParseCloud.php(31): Parse\ParseClient::_request('POST', 'functions/impor...', NULL, '{"sourceId":"Ue...', true)
2024-06-04 17:51:20 #1 /code/src/Import/baseImporter.php(314): Parse\ParseCloud::run('importFailed', Array, true)
2024-06-04 17:51:20 #2 [internal function]: PROJECT\Import\baseImporter->triggerFailedImport('Ue4GHlTWVm')
2024-06-04 17:51:20 #3 {main}
2024-06-04 17:51:20   thrown in /code/vendor/parse/php-sdk/src/Parse/ParseClient.php on line 610
Copy link

parse-github-assistant bot commented Jun 4, 2024

Thanks for opening this issue!

  • 🚀 You can help us to fix this issue faster by opening a pull request with a failing test. See our Contribution Guide for how to make a pull request, or read our New Contributor's Guide if this is your first time contributing.

ajmeese7 added a commit to meese-enterprises/parse-php-sdk that referenced this issue Jun 8, 2024
@ajmeese7 ajmeese7 linked a pull request Jun 8, 2024 that will close this issue
5 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants