question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

logs/laravel.log could not be opened.

See original GitHub issue

The stream or file “/var/task/user/storage/logs/laravel.log” could not be opened: failed to open stream: Read-only file system

Hi @f3l1x, I got error message when deploy laravel project that depends on log file. Here’s the screenshot.

Screen Shot 2021-01-17 at 12 08 54

Here’s the site: https://phpbali-site-o7r82chhh.vercel.app

This log file is a part of settings in https://github.com/GrKamil/laravel-telegram-logging package. When I set LOG_CHANNEL to stack in vercel.json file it throws error like image above.

Here’s my vercel.json config:

{
    "version": 2,
    "builds": [
        { "src": "/api/index.php", "use": "vercel-php@0.3.1" },
        { "src": "/public/**", "use": "@vercel/static" }
    ],
    "routes": [
        {
            "src": "/(css|js)/(.*)",
            "dest": "public/$1/$2"
        },
        {
            "src": "/(.*)",
            "dest": "/api/index.php"
        }
    ],
    "env": {
        "APP_ENV": "production",
        "APP_DEBUG": "true",
        "APP_URL": "https://yoursite.com",

        "APP_CONFIG_CACHE": "/tmp/config.php",
        "APP_EVENTS_CACHE": "/tmp/events.php",
        "APP_PACKAGES_CACHE": "/tmp/packages.php",
        "APP_ROUTES_CACHE": "/tmp/routes.php",
        "APP_SERVICES_CACHE": "/tmp/services.php",
        "VIEW_COMPILED_PATH": "/tmp/views",
        "SSR_TEMP_PATH": "/tmp/ssr",

        "CACHE_DRIVER": "array",
        "LOG_CHANNEL": "stack",
        "SESSION_DRIVER": "cookie",
        "NODE_PATH": "node"
    }
}

I thought that I’m missing additional configuration on “env” in vercel.json file.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:6

github_iconTop GitHub Comments

1reaction
f3l1xcommented, Jan 17, 2021

Hi @satyakresna. There is only 1 writable folder, /tmp. You should change log directory, to the /tmp folder.

0reactions
sebszocinskicommented, Feb 8, 2021

@f3l1x Yes I understand that, but by default Laravel uses the /storage/logs path and Vercel needs this to be re-routed to /tmp but i’m not sure where you do this in Laravel?

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to fix Error: laravel.log could not be opened?
I fixed this problem simply by giving the necessary permission to my folders. Right Click on the logs folder and click on Get...
Read more >
How to fix error laravel log could not be opened in append ...
This error occurs because the web server is unable to write into the error logs in the storage folder. Since, the web server...
Read more >
The stream or file "/storage/logs/laravel.log" could not be ...
laravel - The stream or file "/storage/logs/laravel.log" could not be opened in append mode: failed to open stream: Permission denied.
Read more >
How to fix Error: laravel.log could not be opened? - Tuts Make
In this tutorial, you will learn, how to solve storage/logs/laravel.log” could not be opened: failed to open stream: permission denied.
Read more >
Project Maintainer Edit - For Laravel Developers - GitHub
Permission denied ".../storage/logs/laravel.log could not be opened" #436. viewty opened this issue on Jul 14, 2017 · 19 comments ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found