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

Error when attempting to submit dataset spreadsheet via webpage #862

Closed
only1chunts opened this issue Dec 1, 2021 · 5 comments
Closed

Comments

@only1chunts
Copy link
Member

only1chunts commented Dec 1, 2021

Describe the bug
Error message returned when attempting to submit a prepared spreadsheet submission "Upload failed. Please contact [email protected]"

To Reproduce
Steps to reproduce the behavior:

  1. Go to https://staging.gigadb.org/datasetSubmission/upload
  2. Tick agree to terms and conditions
  3. add a file to be uploaded
  4. click "upload new dataset" button
  5. see error message "Upload failed. Please contact [email protected]"

Expected behavior
the website is suposed to send the spreadsheet to [email protected] AND send a confirmation/thank you letter to the submitter.

** Additional information **
Ticket created from smoke testing question "are automatic emails being sent on dataset submission" in #747

  • Spreadsheet is sent as an attachment to [email protected]
  • Probably configuration problem
@pli888 pli888 added the Peter label Dec 8, 2021
@pli888 pli888 removed the Peter label Dec 16, 2021
@rija rija closed this as completed Dec 23, 2021
pli888 added a commit that referenced this issue Jan 5, 2022
The /datasetSubmission/upload page has been fixed to allow dataset spreadsheet 
upload by authors again.

This fix involved correcting the structure of the rendered HTML code by the 
datasetSubmission/upload view class. An email to the curators is now sent using 
the MailService component. This involved creating a new function for sending HTML 
emails with attachments. There is a new acceptance test to check spreadsheet 
upload functionality.

This closes #862.
@only1chunts
Copy link
Member Author

I am still seeing a bug on this page in the Jan20 version of the staging server, the difference is that it now gives this error message:

Swift_TransportException

Connection could not be established with host :stream_socket_client(): php_network_getaddresses: getaddrinfo failed: Name or service not known

/var/www/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Transport/StreamBuffer.php(261)

249         }
250         $options = [];
251         if (!empty($this->params['sourceIp'])) {
252             $options['socket']['bindto'] = $this->params['sourceIp'].':0';
253         }
254 
255         if (isset($this->params['stream_context_options'])) {
256             $options = array_merge($options, $this->params['stream_context_options']);
257         }
258         $streamContext = stream_context_create($options);
259 
260         set_error_handler(function ($type, $msg) {
261             throw new Swift_TransportException('Connection could not be established with host '.$this->params['host'].' :'.$msg);
262         });
263         try {
264             $this->stream = stream_socket_client($host.':'.$this->params['port'], $errno, $errstr, $timeout, STREAM_CLIENT_CONNECT, $streamContext);
265         } finally {
266             restore_error_handler();
267         }
268 
269         if (!empty($this->params['blocking'])) {
270             stream_set_blocking($this->stream, 1);
271         } else {
272             stream_set_blocking($this->stream, 0);
273         }

Stack Trace

#0 unknown(0): Swift_Transport_StreamBuffer->{closure}(2, "stream_socket_client(): php_network_getaddresses: getaddrinfo fa...", "/var/www/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Transp...", 264, ...)
#1 –  /var/www/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Transport/StreamBuffer.php(264): stream_socket_client("ssl://:465", 0, "php_network_getaddresses: getaddrinfo failed: Name or service no...", 30, ...)259 260 set_error_handler(function ($type, $msg) { 261 throw new Swift_TransportException('Connection could not be established with host '.$this->params['host'].' :'.$msg); 262 }); 263 try { 264 $this->stream = stream_socket_client($host.':'.$this->params['port'], $errno, $errstr, $timeout, STREAM_CLIENT_CONNECT, $streamContext); 265 } finally { 266 restore_error_handler(); 267 } 268 269 if (!empty($this->params['blocking'])) {
#2 –  /var/www/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Transport/StreamBuffer.php(58): Swift_Transport_StreamBuffer->establishSocketConnection()53 case self::TYPE_PROCESS: 54 $this->establishProcessConnection(); 55 break; 56 case self::TYPE_SOCKET: 57 default: 58 $this->establishSocketConnection(); 59 break; 60 } 61 } 62 63 /**
#3 –  /var/www/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Transport/AbstractSmtpTransport.php(143): Swift_Transport_StreamBuffer->initialize(array("protocol" => "ssl", "host" => "", "port" => 465, "timeout" => 30, ...))138 return; 139 } 140 } 141 142 try { 143 $this->buffer->initialize($this->getBufferParams()); 144 } catch (Swift_TransportException $e) { 145 $this->throwException($e); 146 } 147 $this->readGreeting(); 148 $this->doHeloCommand();
#4 +  /var/www/vendor/yiisoft/yii2-swiftmailer/src/Mailer.php(113): Swift_Transport_AbstractSmtpTransport->start()
#5 +  /var/www/vendor/yiisoft/yii2-swiftmailer/src/Mailer.php(156): yii\swiftmailer\Mailer->getSwiftMailer()
#6 +  /var/www/vendor/yiisoft/yii2/mail/BaseMailer.php(263): yii\swiftmailer\Mailer->sendMessage(yii\swiftmailer\Message)
#7 +  /var/www/vendor/yiisoft/yii2/mail/BaseMessage.php(49): yii\mail\BaseMailer->send(yii\swiftmailer\Message)
#8 +  /var/www/protected/components/MailService.php(86): yii\mail\BaseMessage->send()
#9 +  /var/www/protected/controllers/DatasetSubmissionController.php(84): MailService->sendHTMLEmailWithAttachment("[email protected]", "[email protected]", "[GigaDB] New dataset uploaded by user 38 - Chris Hunter", "New dataset is uploaded by:

Id: 38
Ema...", ...)
#10 +  /var/www/vendor/yiisoft/yii/framework/web/actions/CInlineAction.php(49): DatasetSubmissionController->actionUpload()
#11 +  /var/www/vendor/yiisoft/yii/framework/web/CController.php(308): CInlineAction->runWithParams(array())
#12 +  /var/www/vendor/yiisoft/yii/framework/web/filters/CFilterChain.php(134): CController->runAction(CInlineAction)
#13 +  /var/www/vendor/yiisoft/yii/framework/web/filters/CFilter.php(40): CFilterChain->run()
#14 +  /var/www/vendor/yiisoft/yii/framework/web/CController.php(1148): CFilter->filter(CFilterChain)
#15 +  /var/www/vendor/yiisoft/yii/framework/web/filters/CInlineFilter.php(58): CController->filterAccessControl(CFilterChain)
#16 +  /var/www/vendor/yiisoft/yii/framework/web/filters/CFilterChain.php(131): CInlineFilter->filter(CFilterChain)
#17 +  /var/www/vendor/yiisoft/yii/framework/web/CController.php(291): CFilterChain->run()
#18 +  /var/www/vendor/yiisoft/yii/framework/web/CController.php(265): CController->runActionWithFilters(CInlineAction, array("accessControl"))
#19 +  /var/www/vendor/yiisoft/yii/framework/web/CWebApplication.php(282): CController->run("upload")
#20 +  /var/www/vendor/yiisoft/yii/framework/web/CWebApplication.php(141): CWebApplication->runController("datasetSubmission/upload")
#21 +  /var/www/vendor/yiisoft/yii/framework/base/CApplication.php(185): CWebApplication->processRequest()
#22 +  /var/www/index.php(23): CApplication->run()
2022-01-20 18:11:10 nginx/1.21.3 Yii Framework/1.1.20-yii2-2.0.15.1-migration

@rija
Copy link
Contributor

rija commented Jan 21, 2022

reopen as still a problem on staging.
Maybe a problem with the email sending details

@rija rija reopened this Jan 21, 2022
@pli888 pli888 added the Peter label Feb 7, 2022
@pli888
Copy link
Member

pli888 commented Feb 7, 2022

reopen as still a problem on staging.

@only1chunts This is working on the staging server now with the spreadsheet sent as an attachment in the email. Note that the attachment does not have the original Excel filename though.

@only1chunts
Copy link
Member Author

Yes it sends the attachment, but as you noted it does mess up the file name, including removing any file extension which means its difficult to open it. If there is an easy fix to this it would be great to have it now, but if its something that will take a while then we can go "live" with it for now and add it to the backlog for later.
NB- I also noticed a very Ugly breakage when I accidentally clicked the "Upload dataset" button before selecting a file, so that should be made more elegant in the future.

@pli888
Copy link
Member

pli888 commented Feb 8, 2022

NB- I also noticed a very Ugly breakage when I accidentally clicked the "Upload dataset" button before selecting a file, so that should be made more elegant in the future.

Clicking "Upload New Dataset" button before selecting a file is also a problem on the live server. It's because the file selector and Upload New Dataset button both become enabled in the front-end code after the terms and conditions checkbox is checked.

@rija rija closed this as completed Feb 10, 2022
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

4 participants