hey guys, running into this type error: ```const a...
# help
h
hey guys, running into this type error:
Copy code
const authorizer = new HttpLambdaAuthorizer(
  "Authorizer",
  new sst.Function(this, "Authorizer", {})
);

const api = new sst.Api(this, "Api", {
  defaultAuthorizationType: sst.ApiAuthorizationType.CUSTOM,
  defaultAuthorizer: authorizer,
  ^
Type 'HttpLambdaAuthorizer' is not assignable to type 'HttpJwtAuthorizer | HttpLambdaAuthorizer | HttpUserPoolAuthorizer | undefined'.
  Property 'pool' is missing in type 'HttpLambdaAuthorizer' but required in type 'HttpUserPoolAuthorizer'.
f
Hey @Hans Song can I see the version of SST and CDK packages in ur
package.json
h
turns out it was my fault, i added
@aws-cdk/aws-apigatewayv2-authorizers-alpha
with
npm install
rather than
npx sst add-cdk
it went away with these versions
Copy code
SST: 0.69.3
@aws-cdk/aws-apigatewayv2-authorizers-alpha: 2.15.0-alpha.0
aws-cdk-lib: 2.15.0
f
yup, try out v1 when u get a chance. No longer need to have
@aws-cdk/aws-apigatewayv2-authorizers-alpha
in ur package.json 😁
h
on a slightly related note, i’m trying to set up authorization per route but it doesn’t seem to respect per-route settings, e.g. in this snippet, the authorizer does not seem to be invoked at all in
api1
and in
api2
, the authorizer is applied to both
/private
and
/public
the handler in question
f
Change
handler
to
function
in
api1
, ie.
Copy code
const api1 = new sst.Api(app, "Api", {
  routes: {
    "GET /private": {
      function: "src/handlers/somehandler.handler"
      authorizationType: sst.ApiAuthorizationType.CUSTOM,
      authorizer,
    },
  }
})
We also added prop validation in v1, and this will prompt an error 😁
h
sorry, should have specified i’m still using 0.69.3 in that example. i’ll need to give that 1.0 migration doc a good read before i upgrade