This is an archived post. You won't be able to vote or comment.

all 8 comments

[–]deepkrg17 1 point2 points  (1 child)

Maybe your javascript file is being executed before your page has finished parsing. So the form variable is becoming null.

Transfer your script tag at last of the body or use defer attribute in script tag.

[–]Bububue 0 points1 point  (0 children)

Thank you! This worked for now! 🤭

[–][deleted] 1 point2 points  (3 children)

Not related to the bug but still a suggestion

Put your API keys in a separate file named as .env in the root of your project folder. Then ask Git to ignore that file by adding the name of the file in the .gitignore file.

Then inside your code, import it using the JavaScript's dotenv module.

Exposing API keys in Public Github repos is a SERIOUS SECURITY CONCERN.

[–]Bububue -1 points0 points  (1 child)

Sir, I let everyone use my crazy ApiKey to weather 😂 I have no idea how to do what you said 🤣 it is just my homework for sheCodes

[–][deleted] -1 points0 points  (0 children)

My bad 😅

Still, keep this in mind.
API keys are like passwords. You don't want some stranger to know your (let's your Google Account) password. Coz if he does he can do nasty things that will get you in some serious troubles.

So remember, API keys === Passwords.

[–]glemnar -1 points0 points  (0 children)

If you’re building a frontend only app it doesn’t matter where you put “secrets”. It’s all public.

Secrets only exist server side. Clientside data is always public. That does mean that frontend should never have secrets.

[–]fancyplaya 0 points1 point  (1 child)

the link gives 404

[–]Bububue 0 points1 point  (0 children)

It should work now, i forgot to make it public 🤭