php icon indicating copy to clipboard operation
php copied to clipboard

Authentication Using Firebase Admin SDK for PHP

Open denusklo opened this issue 2 years ago • 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?

denusklo avatar Apr 05 '23 17:04 denusklo

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

f3l1x avatar Apr 05 '23 17:04 f3l1x

Can you suggest any ways to handle that?

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

image

denusklo avatar Apr 06 '23 02:04 denusklo

Using ENV is great way. Is it working correctly?

f3l1x avatar Apr 08 '23 12:04 f3l1x

image

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

denusklo avatar Apr 09 '23 13:04 denusklo

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?

denusklo avatar Apr 09 '23 15:04 denusklo

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.

f3l1x avatar Apr 11 '23 20:04 f3l1x

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

denusklo avatar Apr 12 '23 02:04 denusklo