Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

424
Visualizações
Visual Studio Code local run throws error - undefined variable is defined

So I went through a Microsoft online demo on how to do an httpTrigger in Visual Studio Code (language: JavaScript) to upload it to Azure Functions and it was successful. I then started to customize the code so it can do a certain calculation. I got the calculation to be done and I was able to print to console.

Now I'm trying to run it locally so I can pass TWO values to it, but testing it with one. I noticed that in their demo, they were able to use the line:

const name = (req.query.name || (req.body && req.body.name));

where in the body response up top, a default {"name": "Azure"} would present and I sent that value, which came up in their response. Basically, they were able to assign const name with what value was passed in the curly braces with the key value pair {"name": "whateverIputhere"}.

So I decided to try in when running locally, below is the condensed code I am having trouble with:

module.exports = async function (req) {
const var1 = req.query.var1
}

and I've tried passing a parameter in multiple ways. I thought I had to do it as {"var1": "1"} but it would tell me var1 is undefined during the running of the function locally.

Why am I not able to assign it as they did?

Possible clue: There is a sample.dat file that I thought I had to modify to just replace the default entries and it still brings up {"name": "Azure"} as the default entries not sure why.

I am at a loss and would love some help.

about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

I was having an issue only because I was NOT including .query as an option to assign the variable. All other "issues" during the description were quickly gone. Thank you all for looking at this.

about 4 years ago · Juan Pablo Isaza Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda