mtamc / memo

Website for rating books, movies, video games, and TV shows.
0 stars 0 forks source link

Error: 500 when accessing website with local server #30

Closed dustinvtran closed 2 years ago

dustinvtran commented 2 years ago

If I don't log in, I can't view any pages outside the homepage. These pages all state "Error: 500". For example, going to URL http://localhost:8888/list/?type=games&user=nil says the following log:

◈ Rewrote URL to /.netlify/functions/name/nil
Request from ::1: GET /.netlify/functions/name/nil
Response with status 500 in 186 ms.

If I do log in, the homepage's body says "Error: 500" with the same log above. Going to the URL above while logged in returns the same error.

Going to the URL http://localhost:8888/.netlify/functions/name/nil, I see {"error":"DBError","context":"Unauthorized"}.

This bug makes me unable to check out my code changes before I push a commit.

ghost commented 2 years ago

oops

ghost commented 2 years ago

l don't know what's causing this at the moment, just in case can you try npx netlify logout, npx netlify login, then npx netlify dev again?

dustinvtran commented 2 years ago

Still got same errors.

ghost commented 2 years ago

try on the latest version and check if the log shouts about not finding FAUNADB_SERVER_SECRET

ghost commented 2 years ago

Check also:

  1. npx netlify init Should output the following:
    
    This site has been initialized

Site Name: td-memo Site Url: https://nil.moe Site Repo: https://github.com/td-memo/memo Site Id: e386dbc0-92c6-4f88-873a-29fd2dae3f98 Admin URL: https://app.netlify.com/sites/td-memo

To disconnect this directory and create a new site (or link to another siteId)

  1. Run netlify unlink
  2. Then run netlify init again
  3. npx netlify addons:create fauna should say
    
    The "fauna add-on" already exists for td-memo
dustinvtran commented 2 years ago

Indeed, tried on lastest version and got:

◈ Rewrote URL to /.netlify/functions/name/nil
Request from ::1: GET /.netlify/functions/name/nil
{"level":"error","message":"End - Error:"}
{"level":"error","message":"FAUNADB_SERVER_SECRET is not set!!!"}Response with status 500 in 4 ms.

The 1. and 2. output as expected. For 3:

 C:\Users\dustin\Downloads\github\memo> npx netlify addons:auth fauna

Opening fauna add-on admin URL:

https://dashboard.fauna.com/#auth=eyJhbGciOiJIUzI1NiJ9.eyJzaXRlX2lkIjoiZTM4NmRiYzAtOTJjNi00Zjg4LTg3M2EtMjlmZDJkYWUzZjk4IiwiYWNjb3VudF9pZCI6IjYxZTJhYzZiMTBmZGUzMjBjOWE3MDUwNiIsInJlbW90ZV9pZCI6ImUzODZkYmMwLTkyYzYtNGY4OC04NzNhLTI5ZmQyZGFlM2Y5OCJ9.07vbUu1Ar8F9YoAFP4SQwvaIseWwG0hZ93LrE2N3dyg

Opening that link, I see a popup error:

2022-01-31 23_37_12

ghost commented 2 years ago

I added the FAUNADB_SERVER_SECRET to the Netlify env vars instead of relying on the plugin integration to pick it up, try to see if that fixes it.

dustinvtran commented 2 years ago

Cool. It works now.