Azure-docs: The 'scriptFile' property is set to a file that does not exist.

Created on 24 Jun 2019  Â·  11Comments  Â·  Source: MicrosoftDocs/azure-docs

This documentation seems to be missing a step, but I don't know what it is missing exactly. After running this:

func init MyFunctionProj --docker 
(and then choose typescript)
cd MyFunctionProj/
func new --name MyHttpTrigger --template "HttpTrigger"
(and then modify the functions.json)
func host start

I can see these errors:

[6/24/19 4:51:51 PM] Job host started
[6/24/19 4:51:51 PM] The following 1 functions are in error:
[6/24/19 4:51:51 PM] MyHttpTrigger: Invalid script file name configuration. The 'scriptFile' property is set to a file that does not exist.

I am using:
Function Runtime Version: 2.0.12507.0

Thank you


Document Details

⚠ Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.

Pri2 azure-functionsvc cxp doc-bug triaged

Most helpful comment

@dougmolineux we have determined that the correct commands to start a TypeScript project locally are:

npm install
npm start

We have updated the relevant articles as appropriate. Thanks for pointing this out to us and for your help fixing it!

All 11 comments

I have realized that I don't have this issue if I initialize the project using "javascript" instead of "typescript", I think that are missing a step that builds the code and puts it inside a "/dist" directory.

I've opened this Pull Request that adds the required steps for typescript:

https://github.com/MicrosoftDocs/azure-docs/compare/master...dougmolineux:patch-1

@dougmolineux Thank you for your feedback & contribution towards MS Docs! We will review and update as appropriate.

You are very welcome @mike-urnun-msft !

Please let me know if I need to add any more details, thank you for your work on this documentation.

@dougmolineux closing the issue as per comment in the PR#33918

Thank you for taking the time to submit a fix for this issue.

In messing around with this issue, I am wondering if this is actually a template bug.

@ColbyTresness I think that there may be a bug in the HTTP template for Typescript. Are you able to get the Typescript template to run correctly?

@mhoeger the HTTPTrigger Typescript template doesn't have the scriptFile setting. How is it getting added?

{
  "bindings": [
    {
      "authLevel": "function",
      "type": "httpTrigger",
      "direction": "in",
      "name": "req",
      "methods": [
        "get",
        "post"
      ]
    },
    {
      "type": "http",
      "direction": "out",
      "name": "res"
    }
  ],
  "scriptFile": "../dist/MyHttpTrigger/index.js"
}

The scriptFile setting has to be added on creation (and not the template), since the path depends on the name of the function it refers to. I tried this in both VS Code and the core tools and it's working as intended.

@ColbyTresness are you running on Windows?

Yes

Ok I can reproduce it so I’ll take it offline.

@dougmolineux we have determined that the correct commands to start a TypeScript project locally are:

npm install
npm start

We have updated the relevant articles as appropriate. Thanks for pointing this out to us and for your help fixing it!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

AronT-TLV picture AronT-TLV  Â·  3Comments

Agazoth picture Agazoth  Â·  3Comments

jharbieh picture jharbieh  Â·  3Comments

JeffLoo-ong picture JeffLoo-ong  Â·  3Comments

JamesDLD picture JamesDLD  Â·  3Comments