vercel-community/php

Authentication Using Firebase Admin SDK for PHP

denusklo opened this issue · 7 comments

After deployment on vercel and tried to login to my apps, it shows the below message:

The token is invalid: file_put_contents(/var/task/user/storage/framework/cache/data/24/fc/24fc69d48eaa682f929a7045e8f4700237c0083e): Failed to open stream: No such file or directory

Is this because of the php runtime trying to write files on vercel but it has no permission or what?

f3l1x commented

Yes. You have to use /tmp for cache or logs.

Can you suggest any ways to handle that?

is it add cache handler at vercel.json env field?

image

f3l1x commented

Using ENV is great way. Is it working correctly?

image

I have added cache path, but now the session is missing when I try to assess $_SESSION, where should session path locate?

image

the session and cache path I set.

but got this error

image

to solve this error I have tried to set build scripts at package.json to

  • make new folder `tmp/sessions
  • set the permission
  • and list all file at /tmp folder (below is the vercel build log)
    image

Which step did I did wrong, is it the path for sessions is set wrong?

f3l1x commented

There is only /tmp path. If you need deeper structure, you have to create somehow. For example /tmp/sessions, because php will not create /tmp/sessions itself.

fyi I have already make a build script in package.json:

image

and run it in vercel.json:

image

and it actually ran when building vercel runtime:

image