You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When using the nextjs-starter project in the accelerate directory, I was getting failures when attempting to add a new quote to the DB.
It was only when checking out the endpoint in the browser and wrapping my POST request with better error handling that I was able to see this:
exportasyncfunctionPOST(request: Request){try{constresponse=awaitfetch('https://api.quotable.io/random',{cache: 'no-cache',})if(!response.ok){thrownewError(`Fetch error: ${response.status}${response.statusText}`)}constdata=awaitresponse.json()awaitaddQuote(data.content)returnnewResponse(JSON.stringify({quote: data.content}),{headers: {'Content-Type': 'application/json'},status: 201,})}catch(error){console.error('Error in POST request:',error)returnnewResponse(JSON.stringify({error: 'Failed to fetch or add quote.'}),{headers: {'Content-Type': 'application/json'},status: 500,},)}}
This can be negated in development by just setting export NODE_TLS_REJECT_UNAUTHORIZED='0' but I thought I'd let you know! Happy to submit a PR for the docs.
The text was updated successfully, but these errors were encountered:
Hey team,
When using the nextjs-starter project in the accelerate directory, I was getting failures when attempting to add a new quote to the DB.
It was only when checking out the endpoint in the browser and wrapping my POST request with better error handling that I was able to see this:
This can be negated in development by just setting
export NODE_TLS_REJECT_UNAUTHORIZED='0'
but I thought I'd let you know! Happy to submit a PR for the docs.The text was updated successfully, but these errors were encountered: