I am having this issue while using findbyid to get a unique url for a page on my shared hosting. The problem I have is that I keep getting the following error while trying to access the unique page via the Id number of the item on shared hosting(i dont get this issue on localhost):
Error: The action item is not defined in controller ProductsController
Error: Create ProductsController::item() in file: app/Controller/ProductsController.php.
However item is defined in the productscontroller:
public function item($id = null) {
if (!$id) {
throw new NotFoundException(__('product not found'));
}
$items = $this->Product->findById($id);
if (!$items) {
throw new NotFoundException(__('Invalid post'));
}
$this->set('item', $items);
}
you can see the problem at this url: http://entourmag.com/hava/products/item/39
it works on localhost via wamp so I am not sure what the problem is.
Thanks in advance
Well I figured out the issue. The problem was with the files uploaded; the files uploaded were incomplete or missing, when I check the ProductsController.php file I realised that most of the code was missing. Reuploading solved the problem.
For others with problematic internet connection take note of this while coding.
Error: A Database connection using "Mysql" was missing or unable to connect.
The database server returned this error: SQLSTATE[HY000] [1045] Access denied for user 'root'#'localhost' (using password: NO)
Notice: If you want to customize this error message, create app/View/Errors/missing_connection.ctp
I think you have not created/configured your database.php in app/Config
I am using cakephp 3.8 and I figure out one possible cause of this kind of messages.
In my case, I am expecting the __construct method is responsible for creating the base class.
And the solution is to use initialize method, like so:
function initialize() {
parent::initialize();
}
In conclusion, we should more carefully read the documentation, it clearly stated here and please take time to do the 20 min cms tutorial
Related
I have been following the blog post here and I've made it to testing the function on my local environment. I've copy and pasted everything form the blog into my text editor. Nothing in my code is original - but I cannot get it to work! When I try to run it in my local environment, I get this error:
const b = bindings[key].toString();
^
TypeError: Cannot read properties of undefined (reading 'toString')
at PathTemplate.render (/Users/dialogflow-cx/node_modules/google-gax/build/src/pathTemplate.js:114:37)
at SessionsClient.projectLocationAgentSessionPath (/Users/dialogflow-cx/node_modules/#google-cloud/dialogflow-cx/build/src/v3/sessions_client.js:1237:75)
at exports.handler (/Users/Waterfield/dialogflow-cx/functions/dialogflow-detect-intent.protected.js:21:25)
at process.<anonymous> (/Users/dialogflow-cx/node_modules/#twilio/runtime-handler/dist/dev-runtime/internal/functionRunner.js:74:9)
at process.emit (node:events:390:28)
at emit (node:internal/child_process:917:12)
at processTicksAndRejections (node:internal/process/task_queues:84:21)
I don't know where to go from here! Help!
Here your TypeError is "cannot read properties of undefined", that means at least one of your passed arguments is undefined.
As we go through your return error, second line directs to the "projectLocationAgentSessionPath" and this section refers to the "Setup the detectIntentRequest" in the blog .
session: client.projectLocationAgentSessionPath(
context.DIALOGFLOW_CX_PROJECT_ID,
context.DIALOGFLOW_CX_LOCATION,
context.DIALOGFLOW_CX_AGENT_ID,
event.dialogflow_session_id
)
The above error means at least on of the objects that relates to projectId, location, agentId, SessionId is returning undefined.
To resolve the error you have to check whether you are passing correct environment variables the same as .env files or not?
Within the error, we can see that there is a reference to the code you are working on:
at exports.handler (/Users/Waterfield/dialogflow-cx/functions/dialogflow-detect-intent.protected.js:21:25)
This refers to this line:
client.projectLocationAgentSessionPath(
context.DIALOGFLOW_CX_PROJECT_ID,
context.DIALOGFLOW_CX_LOCATION,
context.DIALOGFLOW_CX_AGENT_ID,
event.dialogflow_session_id
)
Following the code through the dialogflow library and then the Google API extensions library shows that ultimately the code is running through the keys of the object that relate to the project, location, agent and session which map to the 4 arguments above. And at least one of them is returning undefined.
Have you added the correct environment variables to your .env file? Are you passing a dialogflow_session_id when you make a request to test this endpoint?
I am struggling with this issue:
InvalidArgumentException: The URI '' is invalid.
You must use a valid URI scheme. in Drupal\Core\Url::fromUri()
(line 284 of core/lib/Drupal/Core/Url.php).
How can I fix this?
You are passing a blank uri into the method. It is complaining about missing a scheme (eg. http:// or https://, or an internal scheme eg: internal:/)
So either you are explicitly passing a blank, or something isn't being set correctly. However, it does not seem to be null.
I had similar issue in Drupal 8 site, please make sure your files directory path is set correctly
I my case files path was Private and it was not configured in settings.php.
$settings['file_private_path'] = 'sites/default/files/private';
From the looks of the source code for the fromUri() function it would appear as though it throws that error when the PHP parse_url function returns an empty scheme:
... elseif (empty($uri_parts['scheme'])) { throw new \InvalidArgumentException("The URI '$uri' is invalid. You must use a valid URI scheme."); ...
From what I can gather in your question you seem to be providing an empty/null value to the fromUri method which is in turn causing the script to error when it attempts to parse the value. So I'd imagine that you'd need to do some kind of check before passing it to the fromUri function.
An example of how to use this method is helpfully provided in the comments section of the fromUri page: https://api.drupal.org/comment/61905#comment-61905
In case your URI is public://, then use:
\Drupal::service('file_url_generator')->generate($file->getFileUri())
Resetting CleanURL Prestashop Module has lead to HTTP ERROR.
Parse error: syntax error, unexpected ''supplier_rule''
(T_CONSTANT_ENCAPSED_STRING), expecting function (T_FUNCTION) in
/home/mbawithf/public_html/mbawithfun.cu.cc/override/classes/Dispatcher.php
on line 4
Now I can not even access backend. I just tried to deleting module from FTP... still didn't work. Any solution?
Delete the Dispatcher file in override folder, or comment the function that includes that line.
Don't forget to delete the cache/class_index.php so Prestashop recreates that file.
PrestaShop tries to manually copy class methods to \override\classes* files, and sometimes the lines miss-match or the line break are wrong, and the end result is incorrectly copied lines which cause syntax errors. That happens both on installation and uninstallation. Basically, you then have to manually fix/remove syntax errors from overridden class files.
What you need is to log on to FTP server and edit this files - fix syntax error.
EDIT:
If you had uninstalled the module, then you should replace the contents of this file with:
class Dispatcher extends DispatcherCore
{
}
Please check that the are no public function ... because if there is, it means that other modules may have inserted their functions here. If there isn't any, then it's safe to reset the file with the code above.
I am calling watch method of gmail to get updates of my mailbox, but it is giving me error
Google::Apis::ClientError: invalidArgument: topicName required
this is the code
service.watch_user('me','projects/devpush/topics/push')
can any one please tell me what is wrong in this?
I had this same problem and after I consulted the source, I found that you need to build a WatchRequest and pass that in to user_watch, like so:
watch_request = Google::Apis::GmailV1::WatchRequest.new
watch_request.topic_name = 'projects/devpush/topics/push'
service.watch_user('me', watch_request)
I'm not familiar with ruby, but maybe you can try giving the topicName as a named parameter?
service.watch_user('me', topicName: 'projects/devpush/topics/push')
Sorry if I'm wrong, but from the error message, you should add a named parameter.
I've downloaded some samples of Lucene.Net library and tried to run but it always throw this error
no segments* file found in Lucene.Net.Store.SimpleFSDirectory#
It throws an error while creating object at this line,
var searcher = new IndexSearcher(_directory, false)
Is anyone has idea on this?
Is there any configuration required to implement this lucene.Net library?
For me it was two issue, 1st this is index was not created so for the 1st time it was throwing this error, Following code resolved that issue.
if (!System.IO.Directory.EnumerateFiles(indexDirectory).Any())
{
return new List<Model>();
}
2nd thing,
Do not forget to dispose object of IndexSearcher,IndexReader and IndexWriter.
Disposing memory of these object in sequence, resolved my issue.