Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error using hono's streamHandle with sst dev: awslambda is not defined #59

Closed
sammyjoyce opened this issue Mar 25, 2024 · 2 comments
Closed

Comments

@sammyjoyce
Copy link
Contributor

sammyjoyce commented Mar 25, 2024

When using hono's streamHandle (which wraps the handle with awslambda.streamifyResponse()) with sst dev, we get the following error:

|  Error       awslambda is not defined
|              ↳ at streamHandle (/Users/<user>/<repo>/node_modules/hono/dist/adapter/aws-lambda/handler.js:17:3)
|              ↳ at <anonymous> (/Users/<user>/<repo>/packages/server/src/main.ts:120:24)
|              ↳ at ModuleJob.run (node:internal/modules/esm/module_job:194:25)

In sst config:

    const api = new sst.aws.Function("Api", {
      handler: "packages/server/src/main.handler",
      url: true,
      link: [
        secrets.anthropicApiKey,
        secrets.openaiApiKey,
      ],
      streaming: true,
    });

Discord Link

@thdxr
Copy link
Contributor

thdxr commented Mar 25, 2024

we don't support streaming yet in dev mode - you can conditionally use the normal handler in those cases

export const handler = process.env.SST_LIVE ? handle(hono) : streamHandle(hono)

note, this variable is there in 0.0.198

@thdxr
Copy link
Contributor

thdxr commented Mar 26, 2024

closing in favor of #63

@thdxr thdxr closed this as completed Mar 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants