Error: `unauthorized` when deployed as a function on netlify. Everything works properly locally

Hi, I have a repo with nuxtjs and netlify functions.

In development mode locally everything works correctly.

When I deploy on netlify I get error: unauthorized in all the functions with fauna crud.

There is a very easy example function you can test in the home page here:

the code is here:

I already added domain: '' to the new faunadb.Client but nothing changed.

Can someone give me some help?

Resolved. Wrong enviroment variabled saved on netlify website. :upside_down_face:

Sometimes the environment variables that you use locally can get out of sync with what you have deployed to Netlify.

Can you describe how you are setting your environment variables (not share the keys, but describe how you are setting them)? You can check the environment variable that you netlify project is using with the command netlify env::ls. Here for an article about managing your environment with Netlify.

Also, did you use the Fauna Netlify Addon to create the database? If so, make sure you complete the process of moving the database to your dashboard with netlify addons:auth fauna.


Ha! you beat me to it, and I hadn’t refreshed my page :grinning_face_with_smiling_eyes:. Glad you got it resolved!

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.