.env to .env.local errors
Answered
American black bear posted this in #help-forum
American black bearOP
Any advice would be greatly appreciated. Happy to provide more info.
Answered by aardani
so in
process.env.NEXT_PUBLIC_UPSTASH_REDIS_REST_URL, add ! in the end to make it string not string | undefined63 Replies
just check out what Requester type requires
by control clicking on it to find the type.d.ts/typings
American black bearOP
it was working with env.SECRET tho
just throwing error when i changed .env file too .env.local and added process (process.env.SECRET)
i dont know what to do with that information because i do not know what Redis() requires
@aardani by control clicking on it to find the type.d.ts/typings
American black bearOP
what do ya mean?
American black bearOP
JSthis guy perhaps
American black bearOP
so in
process.env.NEXT_PUBLIC_UPSTASH_REDIS_REST_URL, add ! in the end to make it string not string | undefinedAnswer
American black bearOP
oops
@aardani so in `process.env.NEXT_PUBLIC_UPSTASH_REDIS_REST_URL`, add `!` in the end to make it `string` not `string | undefined`
American black bearOP
!!! wait ive never heard of adding !
NEXT_PUBLIC_UPSTASH_REDIS_REST_URL="https://usw1-fast-drake-34249.upstash.io" u saying this is unidentified string?no
i didnt say that
i say to add
! in the end of the process.env.REST_URLalso, shouldnt you be keeping the REST_TOKEN server-side only? 

@aardani also, shouldnt you be keeping the REST_TOKEN server-side only? <:meow_stare:763826437341839422>
American black bearOP
yo probably
im new to full stack dev
moreso data science background
@aardani i say to add `!` in the end of the process.env.REST_URL
American black bearOP
, so like process.env.REST_URL!
@aardani also, shouldnt you be keeping the REST_TOKEN server-side only? <:meow_stare:763826437341839422>
American black bearOP
but then how should i access the database?
u know?
this is the verification page
from Next.js server
access to database
access to database
not from the browser
American black bearOP
so i should have another route.ts
that handles that?
@American black bear , so like process.env.REST_URL!
yeah. does it work
American black bearOP
in the api folder
@American black bear so i should have another route.ts
no, page.tsx/layout.tsx is also server-side by default.
(route.ts is also, server-side obviously)
(route.ts is also, server-side obviously)
American black bearOP
nah i mean route.ts
not page.tsx
its up to you where you want to use the process env
you dont need route.ts most of the case
American black bearOP
i want to listen to your advice
i just dont know where io should put the logic of
Does adding
! works?American black bearOP
checking to make sure the email matches the user submission, you know
@aardani Does adding `!` works?
American black bearOP
unfortunately not
throws more errors
what errors
American black bearOP
so confused
perhaps i could screenshare and all that?
i would rather not
American black bearOP
okay np
im tryna stand straight up but this is tough
what library are you using
also add
! to REST_TOKEN@aardani also add `!` to REST_TOKEN
American black bearOP
oh man, how embarassing, that worked!
thank you very much
however, to your point above: you would not recommend including this server-side logic in a client-facing application
sure, that sounds intuitive
American black bearOP
but the logic for this page should be quite simple
okay
thank you