serverless / serverless/serverless

Serverless template for azure node typescript not working

Open
#7,584 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

cat/template provider/azure question
Dominant language
JavaScript
Stars
46.9k
Forks
5.7k
Avg merge
10h 7m
Merged PRs (30d)
57

Description

Bug Report

Description

The default azure template is not working on WSL 2 Ubuntu. ; It has one problem with the version of node (node 12.x isn't supported), and it cannot find the functions once the node10.x is chosen.

  1. What did you do?
    run the following:
npm i -g serverless
 sls --version
Framework Core: 1.67.3 (standalone)
Plugin: 3.6.6
SDK: 2.3.0
Components: 2.29.0

sls create --template azure-nodejs-typescript --name test --path ./test
cd test
npm install
npm start


1. What happened?
First, I got an error message that node12.x was not supported, so I changed that to node10.x
Then I re-ran the npm start and got this:

[4/16/20 7:59:43 AM] No job functions found. Try making your job classes and methods public. If you're us
ing binding extensions (e.g. Azure Storage, ServiceBus, Timers, etc.) make sure you've called the registr
ation method for the extension(s) in your startup code (e.g. builder.AddAzureStorage(), builder.AddServic
eBus(), builder.AddTimers(), etc.).

1. What should've happened?
the hello and goodbye functions should have been found
1. What's the content of your `serverless.yml` file?
The only change from the default was setting node to 10.x (the original 12.x) didn't work, as it claimed it was unsupported:

provider:
name: azure
region: West US 2
runtime: nodejs10.x

prefix: "sample" # prefix of generated resource name

1. What's the output you get when you use the `SLS_DEBUG=*` environment variable (e.g. `SLS_DEBUG=* serverless deploy`)
No difference.
Here's the full output:

test@1.0.0 start /home/leo/work/serverless/test
func host start --typescript

              %%%%%%
             %%%%%%
        @   %%%%%%    @
      @@   %%%%%%      @@
   @@@    %%%%%%%%%%%    @@@
 @@      %%%%%%%%%%        @@
   @@         %%%%       @@
     @@      %%%       @@
       @@    %%      @@
            %%
            %

Azure Functions Core Tools (2.7.2254 Commit hash: ae06bd1a6012aa6a0859b5f30d3077947267d2b6)
Function Runtime Version: 2.0.13017.0
[4/16/20 8:04:22 AM] FUNCTIONS_WORKER_RUNTIME set to node. Skipping WorkerConfig for language:java
[4/16/20 8:04:22 AM] FUNCTIONS_WORKER_RUNTIME set to node. Skipping WorkerConfig for language:powershell
[4/16/20 8:04:22 AM] FUNCTIONS_WORKER_RUNTIME set to node. Skipping WorkerConfig for language:python
[4/16/20 8:04:22 AM] Building host: startup suppressed: 'False', configuration suppressed: 'False', startup operation id: 'a61d9d69-37f9-49c5-8880-502bc1f227ce'
[4/16/20 8:04:22 AM] Reading host configuration file '/home/leo/work/serverless/test/host.json'
[4/16/20 8:04:22 AM] Host configuration file read:
[4/16/20 8:04:22 AM] {
[4/16/20 8:04:22 AM] "version": "2.0"
[4/16/20 8:04:22 AM] }
[4/16/20 8:04:22 AM] Reading functions metadata
[4/16/20 8:04:22 AM] 0 functions found
[4/16/20 8:04:23 AM] Initializing Warmup Extension.
[4/16/20 8:04:23 AM] FUNCTIONS_WORKER_RUNTIME set to node. Skipping WorkerConfig for language:java
[4/16/20 8:04:23 AM] FUNCTIONS_WORKER_RUNTIME set to node. Skipping WorkerConfig for language:powershell
[4/16/20 8:04:23 AM] FUNCTIONS_WORKER_RUNTIME set to node. Skipping WorkerConfig for language:python
[4/16/20 8:04:23 AM] Initializing Host. OperationId: 'a61d9d69-37f9-49c5-8880-502bc1f227ce'.
[4/16/20 8:04:23 AM] Host initialization: ConsecutiveErrors=0, StartupCount=1, OperationId=a61d9d69-37f9-49c5-8880-502bc1f227ce
[4/16/20 8:04:23 AM] LoggerFilterOptions
[4/16/20 8:04:23 AM] {
[4/16/20 8:04:23 AM] "MinLevel": "None",
[4/16/20 8:04:23 AM] "Rules": [
[4/16/20 8:04:23 AM] {
[4/16/20 8:04:23 AM] "ProviderName": null,
[4/16/20 8:04:23 AM] "CategoryName": null,
[4/16/20 8:04:23 AM] "LogLevel": null,
[4/16/20 8:04:23 AM] "Filter": "b__0"
[4/16/20 8:04:23 AM] },
[4/16/20 8:04:23 AM] {
[4/16/20 8:04:23 AM] "ProviderName": "Microsoft.Azure.WebJobs.Script.WebHost.Diagnostics.SystemLoggerProvider",
[4/16/20 8:04:23 AM] "CategoryName": null,
[4/16/20 8:04:23 AM] "LogLevel": "None",
[4/16/20 8:04:23 AM] "Filter": null
[4/16/20 8:04:23 AM] },
[4/16/20 8:04:23 AM] {
[4/16/20 8:04:23 AM] "ProviderName": "Microsoft.Azure.WebJobs.Script.WebHost.Diagnostics.SystemLoggerProvider",
[4/16/20 8:04:23 AM] "CategoryName": null,
[4/16/20 8:04:23 AM] "LogLevel": null,
[4/16/20 8:04:23 AM] "Filter": "b__0"
[4/16/20 8:04:23 AM] }
[4/16/20 8:04:23 AM] ]
[4/16/20 8:04:23 AM] }
[4/16/20 8:04:23 AM] FunctionResultAggregatorOptions
[4/16/20 8:04:23 AM] {
[4/16/20 8:04:23 AM] "BatchSize": 1000,
[4/16/20 8:04:23 AM] "FlushTimeout": "00:00:30",
[4/16/20 8:04:23 AM] "IsEnabled": true
[4/16/20 8:04:23 AM] }
[4/16/20 8:04:23 AM] SingletonOptions
[4/16/20 8:04:23 AM] {
[4/16/20 8:04:23 AM] "LockPeriod": "00:00:15",
[4/16/20 8:04:23 AM] "ListenerLockPeriod": "00:00:15",
[4/16/20 8:04:23 AM] "LockAcquisitionTimeout": "10675199.02:48:05.4775807",
[4/16/20 8:04:23 AM] "LockAcquisitionPollingInterval": "00:00:05",
[4/16/20 8:04:23 AM] "ListenerLockRecoveryPollingInterval": "00:01:00"
[4/16/20 8:04:23 AM] }
[4/16/20 8:04:23 AM] HttpOptions
[4/16/20 8:04:23 AM] {
[4/16/20 8:04:23 AM] "DynamicThrottlesEnabled": false,
[4/16/20 8:04:23 AM] "MaxConcurrentRequests": -1,
[4/16/20 8:04:23 AM] "MaxOutstandingRequests": -1,
[4/16/20 8:04:23 AM] "RoutePrefix": "api"
[4/16/20 8:04:23 AM] }
[4/16/20 8:04:23 AM] Starting JobHost
[4/16/20 8:04:23 AM] Starting Host (HostId=leo3pc-778037752, InstanceId=ccbe746a-5c7e-486a-97b2-b4a9d1134fed, Version=2.0.13017.0, ProcessId=20422, AppDomainId=1, InDebugMode=False, InDiagnosticMode=False, FunctionsExtensionVersion=(null))
[4/16/20 8:04:23 AM] Loading functions metadata
[4/16/20 8:04:23 AM] Reading functions metadata
[4/16/20 8:04:23 AM] 0 functions found
[4/16/20 8:04:23 AM] 0 functions loaded
[4/16/20 8:04:24 AM] Generating 0 job function(s)
[4/16/20 8:04:24 AM] No job functions found. Try making your job classes and methods public. If you're using binding extensions (e.g. Azure Storage, ServiceBus, Timers, etc.) make sure you've called the registration method for the extension(s) in your startup code (e.g. builder.AddAzureStorage(), builder.AddServiceBus(), builder.AddTimers(), etc.).
[4/16/20 8:04:24 AM] Initializing function HTTP routes
[4/16/20 8:04:24 AM] No HTTP routes mapped
[4/16/20 8:04:24 AM]
[4/16/20 8:04:24 AM] Host initialized (259ms)
[4/16/20 8:04:24 AM] Host started (285ms)
[4/16/20 8:04:24 AM] Job host started
Hosting environment: Production
Content root path: /home/leo/work/serverless/test
Now listening on: http://0.0.0.0:7071

Similar or dependent issues:
- #7251

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the azure-nodejs-typescript template generated by sls create, its serverless.yml, and the npm start entry point that runs func host start --typescript. Compare the runtime setting and generated function metadata with the output showing zero functions found, and review related issue #7251. Done means the generated hello and goodbye functions are discovered when the template is started.

Written by the indexing model from the issue text.

Assessment

Tech stack
azure, javascript, node.js, typescript
Domain
backend, cli, cloud
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.