How to use slack logging functionality in laravel 5.6.7? I wrote a line LOG_SLACK_WEBHOOK_URL = "my slack url" in .env file and used Log::emergency("alert testing..."); but did not get any notification on slack. Also i have no idea where to configure slack channel it is required or not.
Laravel 8.X
Setting Slack log just in 4 Steps:
Create Channel > Click on Channel Name > click on Integration tab > Click on Add an App
Now search app i.e. incoming webhook > Click on Install > Click on Add to Slack > Scroll down to Select the channel in which you wish to integrate.
Copy Webhook URL > Open .env file & mention below env name with webhook url.
LOG_SLACK_WEBHOOK_URL=COPIED-WEBHOOK-URL
Lastly, Open config/logging.php > Add slack in channels.stack.channels array as below image.
Done!!
I know this might be too late but anyways somebody might find this helpful.
You have to add incoming-webhook app into your slack channel.
It will generate special URL (something like 'https://hooks.slack.com/services/...) for you
Set it in your .evn file or as second argument of env() call in logging.php (as I done it)
Check slack.level value because it is set pretty high and I wanted to get every mesage so I set it to debug (the lowest level possible) (visible in screenshot too)
You can now test if or example with php artisan tinker -> Log::error('Test works');
Hope this will help somebody
Related
I have a webapp in production that interacts with Google Drive through Google Drive API.
I need to change some settings in Drive interaction but I can't save.
When I save the Drive UI integration page, I receive this error:
There's a problem at our end.
Please try again. If the problem persists, please let us know using
the "Send feedback" link below. Thanks!
(spying Network console: there is an Internal Server Error in a POST call)
I tried to send feedback for months: nobody answers and the bug is still there.
I tried also to create another project: I can save the first time but then the bug returns.
How can I do? Has someone the same problem?
Is there a way to receive a reply from Google? Is there some workaround?
Thank you.
i think that problem must be Client ID
before adding Client ID, go to the Credentials -> OAuth 2.0 Client IDs
then select edit your Client ID. after that your production site url add to Authorized JavaScript origins and Authorized redirect URIs.
then enter your Client ID in Drive UI integration page
For myself trying to get the Drive UI configured I noticed a couple of errors (that don't have any specific error messages)
When adding in an Open URL it has to be a valid domain, so for instance I tried to test it out with local host, to no avail. However something like https://devbox.app.com worked, but something like https://localhost:8888 does not. Even though https://localhost is a valid javascript origin in the client_id configuration (at least for the app I am working on, not sure about other apps), localhost doesn't work as an open URL.
When adding in the mimeTypes it needs to be in the format */* and can include custom mimeTypes like application/custom+xml and application/custom-name+json not sure for other custom types that are not in a particular format like xml or json. Also not sure about wildcards.
When adding in file extensions do not add in the '.' just the name of the file extension.
The app icon I found only failed to upload the image when the image wasn't the exact dimensions, I actually ended up editing some icons in photoshop to change the pixel x pixel values as a quick work around during dev.
That worked for me to get it to save and I tested it with a file that had a custom mimeType (application/custom-name+xml specifically) and custom file extension!
I am trying to send a slack failure notification if the Jenkins build is a failure.
However, whenever the notification comes in slack, it is not a clickable URL. It comes as http://${MASTER_NODE}:1234/job/abc/2/
I am not able to make the master node of Jenkins dynamic, as a result, it just prints as MASTER_NODE and not converting to a clickable URL.
Any possible solution for this?
Instead of using this http://${MASTER_NODE}:1234/job/abc/2/,
$BUILD_URL in custom message
click here to see image
When making an auth request to the Google API (gapi), it's returning false on the checkOrigin.
I have removed any client id's or anything that would link directly to my account and replaced it with a regex indicating what the data is for reference.
Url: https://accounts.google.com/o/oauth2/iframerpc?action=checkOrigin&origin=https%3A%2F%2Flocal.tools&client_id=(\d{21})
My origin url is a local url, which is https://local.tools
Result: {valid: false}
I'm using the example found here without deviation (except for replacing clientid with my 21 digit clientid): https://ga-dev-tools.appspot.com/embed-api/third-party-visualizations/
The items I'm trying to display show up nicely on the demo site, but aren't getting past the Not valid origin for the client error on my local.tools site.
Clear your browser cache. Started getting this error in Chrome and then I created a new client id and was still getting the issue. Opened firefox and it worked, so I cleared the cache on Chrome and it started working.
I received the same console error message when working with this example: https://developers.google.com/analytics/devguides/reporting/embed/v1/getting-started
The documentation says not to overlook two critical steps ("As you go through the instructions, it's important that you not overlook these two critical steps:
Enable the Analytics API [&] Set the correct origins"), but does not clearly state WHERE to set the correct origins.
Since the client ID I had was not working, I created a new project and a new client ID. The new project may not have been necessary, but I'm retaining (and using) it.
Here's what worked:
Create a new project
Add and Enable the Analytics API
Create a new credential - ensure that it is an OAUTH credential (scroll to the bottom of this page for instructions https://developers.google.com/api-client-library/javascript/start/start-js#Setup).
During creation of the credentials, you will see a section called "Restrictions
Enter JavaScript origins, redirect URIs, or both". This is where you can enter your origins.
Save and copy your client ID (and secret).
My script worked after I created the new OAUTH credential, assigned the origin, and used the newly generated client ID following this process.
try clear caches and then hard reload, i had same error but when i tried to run on incognito browser in chrome it worked.
Key Point: Add both http://localhost and http://localhost:port_number to the Authorized JavaScript origins box for local tests or development.
Credentials do not work if API is not enabled. In my case the next steps were needed:
Go to https://console.developers.google.com/apis/library
Enter 'People'
From the result choose 'Google People API'
Click 'Enable'
Creating new oauth credentials worked for me
You probably use Client ID like this: <CLIENT_ID>.apps.google.com
Make sure your client ID is without ".apps.google.com"
For me - I just went here:
https://console.developers.google.com/apis/credentials
Then chose the right project; then choose the credential with the same ID shown in your console error message. When editing the credentials you can add multiple origins to the white list.
After updated Authorized JavaScript origins browser still caching old data, so I need to Empty cache and hard reload then it works
1. Change Authorized origins
2. Open Dev Tool (F12) then right-click into reload button
Clearing the cache on chrome works!
Please find the steps below to clear the cache.
Open dev tools (Right-click on the page and select inspect/ press F12)
Right-click on the chrome reload button while the dev tool is opened. (You will find the option to clear the cache and reload the site)
clearing the cache works for me.
for React developers try to restart the project otherwise it will show the same error again and again.
It was a referrer-policy problem.
This has been such a pain for a long time to me too...
Found the issue, my website instance had a referrer policy set to
no-referrer. After setting it to no-referrer-when-downgrade, the One
Tap prompt showed up as expected.
https://stackoverflow.com/a/63039142/15565029
If you are using Django, SECURE_REFERRER_POLICY is 'same-origin' by default. Change it by adding the below code in your settings file.
# settings.py
SECURE_REFERRER_POLICY = 'no-referrer-when-downgrade'
https://docs.djangoproject.com/en/3.2/ref/settings/#std:setting-SECURE_REFERRER_POLICY
Similar to few answers at above but with screenshots. If you created project for Firebase, may also use the same steps to configure at Google Cloud Platform console.
Select the project at https://console.cloud.google.com/
Navigate to Credentials
Click Edit button for the related OAuth 2.0 Client ID
Add URI into Authorized JavaScript origins
Don't forget to Save
That worked for me after trying for an hour:
On https://console.cloud.google.com/apis/credentials :
Edit Client Outh (mine was: Web Client (Auto Created by Google Service), which was created by my Firebase Web Project)
Enter JavaScript Origin for the Client ID (mine was: localhost:NNNN)
and don't forget to Save.
Try google login for half an hour: didn't work
Enabled Google Analytics as suggested above
Empty Chrome cache and hard reload as suggested above
Try google login for half an hour: didn't work
Sign Out from https://console.cloud.google.com, and sign in again
Empty Chrome cache and hard reload
Now it worked
I don't know which one of the above fixed the problem.
May be it was just a matter of time for cloud.google to
recognize my new JavaScript Origin.
I got the error because of Allow-Control-Allow-Origin: * browser extension.
Trying on a different browser(chrome) worked for me and clearing cache on firefox cleared the issue.
(PS: Not add the hosting URIs to Authorized JavaScript origins in API credentials would give you Error:redirect_uri_mismatch)
I was getting the same error but tried publishing my app and now it shows as below:
I've recently upgraded to Magento CE 1.9.1.0 and our order confirmation emails are not being sent to customers or the employees here that are setup to receive notifications.
I checked the Email Logs and don't see the emails hitting the server at all.
Emails come through from the Contact Form, New User Account Signup and a few test scripts I created on the server. I made sure that Disable Email Communications was set to "No".
Any ideas? They worked great in 1.7.0.2 before we upgraded.
Starting from Magento 1.9 the order confirmation emails are not sent during checkout anymore, instead they are sent with the Cron. To verify this works properly:
make sure your system Cron is up and running (you can check the Cron logs: /var/log/cron to verify that).
make sure Magento Cron is setup correctly and is running every some minutes. You should see something like this in the Crontab of your system:
*/5 * * * * /public_html/cron.sh
This schedules a task to run cron.sh every five minute. (More reading)
There are good extensions like AOE Scheduler in Magento that help you to monitor and manage Cron jobs.
An alternative way to this is to disable the Cron for these kind of emails (order confirmation). To do this you can go to this path:
public_html/app/code/core/Mage/Sales/Model/Order.php
Copy that file and bring it to this path (if the path doesn't exist create it):
public_html/app/code/local/Mage/Sales/Model/Order.php
And then change this line:
$mailer->setQueue($emailQueue)->send();
To:
$mailer->send();
However I recommend spending some time to setup the Cron instead. I think if they wanted to use Cron for these emails it's for a reason.
Just do a small change in order.php (public_html/app/code/core/Mage/Sales/Model/Order.php)
From
$mailer->setQueue($emailQueue)->send();
To
$mailer->send();
Solution is simple that i found.
go to System -> Configuration -> ASCHRODER EXTENSIONS -> SMTP -> Queue Configuration -> Queue Usage -> Never
Done!
Order Confirmation will be sent quickly. :)
Quick solution is:
Go to the following location: /app/code/core/Mage/Core/Model/Email/Template.php
Change Line 407
if ($this->hasQueue() && $this->getQueue() instanceof Mage_Core_Model_Email_Queue) {
To:
if (!($this->hasQueue() && $this->getQueue() instanceof Mage_Core_Model_Email_Queue)) {
It will work.
Thanks Pankaj
Please ovewrite 'app/code/core/Mage/Sales/Model/Order.php' file.if you dont want to any changes in xml file so So just copy /app/code/core/Mage/Sales/Model/Order.php into /app/code/local/Mage/Sales/Model/Order.php and be sure to refresh the cache. and change
$mailer->setQueue($emailQueue)->send();
To
$mailer->send();
Goto /app/code/core/Mage/Core/Model/Email/Template.php
Below changes :
if ($this->hasQueue() && $this->getQueue() instanceof Mage_Core_Model_Email_Queue) {
To
if (false){
I had exactly the same problem. For me it was a local copy of the order.php that I had made some changes to in the past and that I had copied to \app\code\local\Mage\Sales\Model\Order.php.
Thus, the updated order.php of Magento 1.9.1.0 in the core directory was not in usage - causing the order confirmation emails not to be send automatically via the cron job.
I keep the fingers crossed that you suffer from the same issue.
Just add cron in cpanel or plesk panel. It will available on cpanel -> Advanced and click cron folder. Then proceed:
*/5 in the 'minute' field (may customize this)
* in the 'hour' field
* in the 'day' field
* in the 'month' field
* in the 'weekday' field
comment: http://www.yoursite.com/absolute/path/to/magento/cron.php
There are many answers but none worked for me. How i solved is that,
check that if your default template setup are there in the magento or not. Sometimes during installation its lost and actually "there is no email template by default in system to send your email". Please go to Admin side, System->Transactional Email-> by default you will find no template here. So add one by clicking on button 'Add new Email template. In Load default template panel select a template from the Template drop down suppose forgot Password and click and click Load Template. As earlier said no email template is associated with it so it will not be show in below. The bset thing is to go to install a fresh copy of magento in your local system navigate here and put that same content here and click Save Template button.
Then go to System->Configuration->Customer Configuration ->Password Options->Change the 'Forgot Email Template' dropdown to yours as added above .Happy . thus same thing you can also do for order ,shipment, new account etc.
To debug magento order mail issue regarding new order just run yoursite.com/cron.php
If you recieve any mail now then its cron issue.
You can fix con issue by setting cron in cpanel.
How can I check the error logs of Heroku,
without running:
heroku logs
Since I'm using Codeship.io, I can't use 'heroku' commands
There is a free heroku add on, Papertrail.
And this to your heroku app (can be done command line or via the heroku UI)
then on your Resources tab you can click Papertrail.
Helpfull note with Papertaril, you can set up email notifications on string comparisons. This can help for early fault detection.
If you have access to the heroku app you could view the logs from there:
(open the app page then press the dotted more button on the top right then press view logs)
(requires you to keep the logs page open)
logs one
logs two
or set up a webhook
(open the app page then press the dotted more button on the top right then press view webhooks and once the page has loaded click create webhook then set-up your webhook)
(i use it with discord: Ohttps://support.discordapp.com/hc/en-us/articles/228383668-Intro-to-Webhooks)
(may not have an error option)
webhooks one
webhooks two
webhooks three
or like gregmcpugh said you could use the add on papertrail. (which i also use)
There is a free heroku add on, Papertrail.
And this to your heroku app (can be done command line or via the heroku UI) then on your Resources tab you can click Papertrail.
Helpful note with Papertrail, you can set up email notifications on string comparisons. This can help for early fault detection.
(no bad thing i can say about this one!)
papertrail one
papertrail two
papertrail three
damn people being before me :P
hope i helped! :D