Skip to content

Compilation hangs on flow with async functions #123

@jumski

Description

@jumski

@cpursley reported on Discord:

Running the compile on a flow is hanging. Detials in thread.

npx pgflow@latest compile supabase/functions/_flows/upload_company_logo.ts        
                __ _                 
   _ __   __ _ / _| | _____      __  
  | '_ \ / _' | |_| |/ _ \ \ /\ / /  
  | |_) | (_| |  _| | (_) \ V  V /   
  | .__/ \__, |_| |_|\___/ \_/\_/    
  |_|    |___/



┌  pgflow - Compile Flow to SQL
│
●  Compiling flow: upload_company_logo.ts
│
●  Running Deno compiler

Flow definition:

import { Flow } from 'npm:@pgflow/dsl';
import processCompanyLogoTask from '../_tasks/processCompanyLogoTask.ts';
import updateCompanyLogoUrlTask from '../_tasks/updateCompanyLogoUrlTask.ts';

type Input = {
    logo_url: string;
    company_slug: string;
    company_id: string;
};

export default new Flow<Input>({
    slug: 'upload_company_logo',
    maxAttempts: 3,
    timeout: 60,
    baseDelay: 2,
})
    .step(
        { slug: 'process_company_logo' },
        async (input) => await processCompanyLogoTask({
            logo_url: input.run.logo_url,
            company_slug: input.run.company_slug,
        })
    )
    .step(
        { slug: 'update_company_logo_url', dependsOn: ['process_company_logo'] },
        async (input) => await updateCompanyLogoUrlTask({
            company_id: input.run.company_id,
            file_path: (input.process_company_logo as { file_path: string }).file_path,
        })
    ); 

After I commented out those asyncs, it ran. So maybe that script needs some better error reporting if the logic does not work.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions