AskYous
AskYous

Reputation: 4750

Function load error: Code could not be loaded

When I try to run sudo functions deploy login --trigger-http, I get the following error:

ERROR: Function load error: Code could not be loaded.

ERROR: Does the file exists? Is there a syntax error in your code?

ERROR: Detailed stack trace: module.js:549

But I already have an index.js file in /lib. I don't know if there's a bigger issue than this because I just solved my last issue. Or this could be unrelated. I've been having a hard time gettings functions running locally with debugging:

enter image description here

Upvotes: 0

Views: 951

Answers (2)

Zemmy Indrapatih
Zemmy Indrapatih

Reputation: 77

Additional answer to make more clear. In my case, i'm trying to run my function inside google functions-emulator then this error happen. But with short solution from @AskYous, i still got a little confuse.

So like @AskYous answer, we have to enter into functions folder, then type like this:

C:\FirebaseFunctionTypescript\functions>functions deploy api --trigger-http

The "api" is our exported functions inside index.ts file. Sample project

Upvotes: 0

AskYous
AskYous

Reputation: 4750

I found the answer. I had to change directories into the functions folder.

Upvotes: 5

Related Questions