Launching Node App -- Error Incorrect Function

OS: Windows 10
Version: flyctl.exe v0.0.387 windows/amd64 Commit: d46c14f3 BuildDate: 2022-09-01T21:55:51Z

Hello, I’m trying to host on Fly for the first time. I have a basic node/Koa app and I get no errors when I build or run the script, but when I try to run flytctl launch I get the following error:

$ flyctl launch
Creating app in C:\Users\...
Scanning source code
Detected a NodeJS app
Using the following build configuration:
        Builder: heroku/buildpacks:20
? App Name (leave blank to use an auto-generated name): Error Incorrect function.

There are no logs or messages and I haven’t been able to find another post regarding this issue. I get the same error on the example app or with a docker image.

server file:

import koa from 'koa'
import Router from '@koa/router'
import passport from 'koa-passport'
import session from 'koa-session'
import mongoose from 'mongoose'
import routes from './routes/authRoutes'
import './services/passport'

const app = new koa()
const router = new Router()

app.keys = [process.env['COOKIE_KEY'] as string];
mongoose.connect(process.env['MONGO_URI'] as string)

app.use(session(CONFIG, app));

app.use(async function handleError(ctx, next) {
  try {
    await next()
  } catch (error) {
    ctx.status = 500
    ctx.body = error

const PORT = process.env['PORT'] || 5000

Yeah I haven’t seen that particular error either :thinking:.

I don’t know the innards of the buildpacks that it is defaulting to there, so in case that is the issue, it may be worth switching to the Dockerfile approach to building an image. See if that has more luck. If you are not used to Docker (no idea) it’s simpler than it looks. You basically add a Dockerfile and .dockerignore file. And then when you run fly launch, it spots that file and takes a different approach (as the Dockerfile tells Fly how to build the image). I generally have success with that way anyway!

For a basic hello-world Node app, take a look at the files here:

You will see a bare-bones Dockerfile, .dockerignore and fly.toml already there (if you were to use the fly.toml, update the app name within it to one of your choice, naturally). Should be pretty well commented.

Hi Greg, thank you for the suggestion. Unfortunately setting up a Docker image gave me the same error. I tried again using the example app here GitHub - fly-apps/hellonode-builtin: A minimal Fly example Node application for use in tutorials and I am getting the same error.

1 Like

Ah. That’s not good.

One for Fly then, I’m afraid.

Hi @bouhm,

It looks like you are on Windows.

Please include the version of your flyctl.

flyctl version

flyctl.exe v0.0.387 windows/amd64 Commit: d46c14f3 BuildDate: 2022-09-01T21:55:51Z


It’s current and confirms the platform info.

The original post looks like it failed when trying to generate an app name. I assume you already tried it, but did you specify an app name and it fails the same way?

It fails and exits the process before I get a chance to input a name for the app.

I tried using Powershell instead of Git Bash for the terminal and I no longer got the error. It works on CMD as well so it seems to be an issue with Git Bash.

Thanks for your help, everyone!

1 Like