Enrique Santeliz
04/29/2021, 7:58 PMnpx create-serverless-stack@latest my-sst-app --language typescript
. And treating this as one of the packages of the monorepo.
The problem begins when I try to use other packages from my monorepo to develop something.
I have two packages:
rest-api
this is the sst package
@temis/utils
this is another typescript package
Inside rest-api
I do a yarn add @temis/utils
in order to use this package as a dependency, and develop some logic.
So, I run yarn build
inside @temis/utils
and builds successfully.
Then I run the same in rest-api
and when its linting the code, this happens:
.../dist/validator/index.js
3:7 error Unexpected dangling '_' in '__createBinding' no-underscore-dangle
4:12 error Unexpected dangling '_' in '__createBinding' no-underscore-dangle
6:7 warning Unexpected unnamed function func-names
7:31 error Assignment to function parameter 'k2'
.........
There was a problem linting the source.
There was an error synthesizing your app.
Note that the sst package is trying to lint the compiled code from @temis/utils
(using the dist folder: dist/validator/index.js).
The tsconfig in @temis/utils
is simple:
{
"compilerOptions": {
"declarationMap": false,
"target": "es5",
"module": "commonjs",
"strict": true,
"allowSyntheticDefaultImports": true,
"esModuleInterop": true,
"skipLibCheck": true,
"forceConsistentCasingInFileNames": true,
"outDir": "./dist",
"rootDir": "./src"
}
}
And the tsconfig in the sst package is the default one, I haven't touched it so far:
{
"compilerOptions": {
"target": "ES2018",
"module": "commonjs",
"lib": [
"es2018",
"dom"
],
"types": [
"node"
],
"declaration": true,
"strict": true,
"noImplicitAny": true,
"strictNullChecks": true,
"noImplicitThis": true,
"alwaysStrict": true,
"noUnusedLocals": false,
"noUnusedParameters": false,
"noImplicitReturns": true,
"noFallthroughCasesInSwitch": false,
"inlineSources": true,
"experimentalDecorators": true,
"strictPropertyInitialization": false,
"sourceMap": true,
"baseUrl": ".",
"esModuleInterop": true,
"skipLibCheck": true
},
"include": [
"lib",
"src"
]
}
So, anyone has faced this problem before?
Maybe its related to some typescript specific config that I don't know yet. I fairly new using typescript.
Thank you in advanceWarwick Grigg
05/04/2021, 2:00 PMAnthony Xiques
05/06/2021, 5:46 PMCliffordNoal
05/06/2021, 10:56 PMJohn Nguyen
05/07/2021, 4:52 PMAshishkumar Pandey
05/08/2021, 4:28 AMAccessDeniedException: User: arn:aws:sts::654873835773:assumed-role/xx-ApiLambdaPOSTjobsService-xx/xx-ApiLambdaPOSTjobsxx is not authorized to perform: iam:PassRole on resource: arn:aws:iam::xxxxxxxxx:role/service-role/some-role
Ashishkumar Pandey
05/08/2021, 5:12 AMAshishkumar Pandey
05/09/2021, 3:25 AMSachin Titus
05/10/2021, 6:56 AMSimon Reilly
05/11/2021, 7:56 AMnpx sst stop
for tearing down the debug environment?Robert Kmieciak
05/13/2021, 10:57 AMArtem Kalantai
05/13/2021, 2:54 PMAshishkumar Pandey
05/13/2021, 11:28 PMAshishkumar Pandey
05/14/2021, 5:47 PMAshishkumar Pandey
05/14/2021, 7:22 PMSubprocess exited with error 255
Error: Subprocess exited with error 255
at ChildProcess.<anonymous> (/Users/ashish/work/planet-marathi/pm-admin-api/node_modules/aws-cdk/lib/api/cxapp/exec.ts:122:23)
at ChildProcess.emit (node:events:365:28)
at ChildProcess.emit (node:domain:470:12)
at Process.ChildProcess._handle.onexit (node:internal/child_process:290:12)
There was an error synthesizing your app.
How should I go about debugging this?Adie Williams
05/19/2021, 10:15 AMPaulo Castellano
05/21/2021, 1:47 AMMarcelo Olivas
05/21/2021, 2:25 AM{
"error": "invalid_scope"
}
when trying to get my token from the POST <https://service-api-pool-domain-jedi-master.auth.us-east-1.amazoncognito.com/oauth2/token>
here’s my infra code:
import * as cognito from "@aws-cdk/aws-cognito";
import * as apiAuthorizers from "@aws-cdk/aws-apigatewayv2-authorizers";
import * as sst from "@serverless-stack/resources";
export default class MyStack extends sst.Stack {
constructor(scope, id, props) {
super(scope, id, props);
//Create user pool
const userPool = new cognito.UserPool(this, "UserPool", {
userPoolName: "UserPool"
})
new cognito.CfnUserPoolResourceServer(this, "dev-userpool-resource-server", {
identifier: "vehicles",
name: "vehicles api",
userPoolId: userPool.userPoolId,
scopes: [
{
scopeDescription: "Get vehicles",
scopeName: "read",
},
],
});
const userPoolClient = new cognito.UserPoolClient(this, "UserPoolClient", {
userPool,
generateSecret: true,
preventUserExistenceErrors: true,
oAuth: {
flows: {
clientCredentials: true,
},
scopes: [cognito.OAuthScope.custom("vehicles/read")]
},
authFlows: {
userSrp: true,
refreshToken: true
},
supportedIdentityProviders: [cognito.UserPoolClientIdentityProvider.COGNITO]
})
new cognito.UserPoolDomain(this, "UserPoolDomain", {
userPool,
cognitoDomain: {
domainPrefix: 'service-api-pool-domain-jedi-master'
}
})
// Create the HTTP API
const api = new sst.Api(this, "Api", {
defaultAuthorizer: new apiAuthorizers.HttpUserPoolAuthorizer({
userPool,
userPoolClient
}),
defaultAuthorizationType: sst.ApiAuthorizationType.JWT,
routes: {
"GET /vehicles": "src/list.main",
"GET /vehicles/{id}": "src/get.main",
"PUT /vehicles/{id}": "src/update.handler"
},
});
// Show API endpoint in output
this.addOutputs({
"ApiEndpoint": api.url,
});
}
}
Artem Kalantai
05/22/2021, 7:24 AMArtem Kalantai
05/22/2021, 7:24 AMconst userPool = cognito.UserPool.fromUserPoolId(stack, "users", "us-east-1_iYNNUVj0l");
Artem Kalantai
05/22/2021, 1:26 PMThe provider Google does not exist for User Pool us-east-1_Qdzu6iix4.
Matt Stibbard
05/24/2021, 6:19 AM$ serverless deploy
Serverless: DOTENV: Loading environment variables from :
Serverless: Deprecation warning: CLI options definitions were upgraded with "type" property (which could be one of "string", "boolean", "multiple"). Below listed plugins do not predefine type for introduced options:
- ServerlessPlugin for "out"
- ServerlessOffline for "apiKey", "corsAllowHeaders", "corsAllowOrigin", "corsDisallowCredentials", "corsExposedHeaders", "disableCookieValidation", "enforceSecureCookies", "hideStackTraces", "host", "httpPort", "httpsProtocol", "lambdaPort", "noPrependStageInUrl", "noAuth", "ignoreJWTSignature", "noTimeout", "prefix", "printOutput", "resourceRoutes", "useChildProcesses", "useWorkerThreads", "websocketPort", "webSocketHardTimeout", "webSocketIdleTimeout", "useDocker", "layersDir", "dockerReadOnly", "functionCleanupIdleTimeSeconds", "allowCache"
Please report this issue in plugin issue tracker.
Starting with next major release, this will be communicated with a thrown error.
More Info: <https://www.serverless.com/framework/docs/deprecations/#CLI_OPTIONS_SCHEMA>
Serverless: Deprecation warning: Resolution of lambda version hashes was improved with better algorithm, which will be used in next major release.
Switch to it now by setting "provider.lambdaHashingVersion" to "20201221"
More Info: <https://www.serverless.com/framework/docs/deprecations/#LAMBDA_HASHING_VERSION_V2>
Serverless: Bundling with Webpack...
Starting type checking service...
Serverless: No external modules needed
Serverless: Packaging service...
Serverless: Uploading CloudFormation file to S3...
Serverless: Uploading artifacts...
Serverless: Uploading service hello.zip file to S3 (73.5 KB)...
Serverless: Validating template...
Serverless: Updating Stack...
Serverless: Checking Stack update progress...
.................
Serverless: Operation failed!
Serverless: View the full error output: <https://ap-southeast-2.console.aws.amazon.com/cloudformation/home?region=ap-southeast-2#/stack/detail?stackId=arn%3Aaws%3Acloudformation%3Aap-southeast-2%3A302062797280%3Astack%2Fnotes-ts-api-dev%2F08ea8a50-bc56-11eb-8a72-0a35287a3dce>
Serverless Error ----------------------------------------
An error occurred: HelloLambdaFunction - Resource handler returned message: "Uploaded file must be a non-empty zip (Service: Lambda, Status Code: 400, Request ID: bla, Extended Request ID: null)" (RequestToken: bla, HandlerErrorCode: InvalidRequest).
Get Support --------------------------------------------
Docs: <http://docs.serverless.com|docs.serverless.com>
Bugs: <http://github.com/serverless/serverless/issues|github.com/serverless/serverless/issues>
Issues: <http://forum.serverless.com|forum.serverless.com>
Your Environment Information ---------------------------
Operating System: win32
Node Version: 16.2.0
Framework Version: 2.43.0
Plugin Version: 5.1.3
SDK Version: 4.2.2
Components Version: 3.10.0
Artem Kalantai
05/24/2021, 4:13 PMnew cdk.CfnOutput(stack, "core", {
value: exporedValue,
});
Dirk Stewart
05/24/2021, 6:57 PMDennis Dang
05/25/2021, 2:17 AMimport { LineItemStatus as TLineItemStatus } from "@canopyinc/api-docs/types/ts/EditLineItemInput.type";
but it remains as an unused variable artifact in the lambda file as
var import_EditLineItemInput = __toModule(require("@canopyinc/api-docs/types/ts/EditLineItemInput.type"));
Ashishkumar Pandey
05/25/2021, 8:07 AMAnthony Xiques
05/25/2021, 7:45 PMIn our example, we want to share some common code. We’ll be placing these in aSo in my monorepo, I have:directory. Our services need to make calls to various AWS services using the AWS SDK. And we have the common SDK configuration code in thelibs/
file.libs/aws-sdk.js
- service1/
- service2/
- libs/
- - - automation-helper
And in service1
:
import { convertJsonStrToObj, generateResponse, validatePayload } from '../../libs/automation-helper';
But I'm getting this serverless error when running serverless invoke local
😭
Any ideas? Thanks!Dennis Dang
05/25/2021, 10:25 PMDennis Dang
05/26/2021, 1:19 PMJeffrey Budnick
05/26/2021, 8:36 PM