Questions tagged with Developer Tools
Content language: English
Sort by most recent
Hello,
I created HTTP API gateway with private resource. My question is that is it possible to create HTTP API with stage variable for private resource.
I mean I want to create stage variable and I want to call vpc link according to this variable in HTTP API for private resource.
I am using nodejs and "sam sync". I have a layer with shared js code that doesn't need to be built. I am using ES Modules for imports.
While I have this working, any changes to my shared code module results in a "Build method missing in layer" error making quick iteration difficult.
SAM CLI, version 1.70.0
Directory structure:
```
layers-test/{template.yaml, samconfig.toml}
layers-test/hello-world/{app.js, package.json}
layers-test/shared-code/tools/{tools.js, package.json}
layers-test/shared-code/util/{util.js, package.json}
layers-test/shared-modules/{package.json, package-lock.json, node_modules/}
```
hello-world/app.js:
```
import pick from "lodash.pick";
import { utilFunction } from "/opt/util/util.js";
import { toolsFunction } from "/opt/tools/tools.js";
export const lambdaHandler = async (event, context) => {
try {
utilFunction();
toolsFunction();
console.log('rez:', pick({ a: 40, b: 30, c: 20 }, ['a', 'b']));
return {
'statusCode': 200,
'body': JSON.stringify({
message: 'hello world',
})
}
} catch (err) {
console.log(err);
return err;
}
};
```
shared-modules/package.json:
```
{
"name": "shared-modules",
"version": "1.0.0",
"description": "",
"dependencies": {
"lodash.pick": "^4.4.0"
}
}
```
shared-code/util/util.js:
```
export const utilFunction = () => {
console.log('running utilFunction');
};
```
shared-code/util/package.json:
```
{
"name": "util",
"version": "1.0.0",
"description": "",
"main": "util.js",
"type": "module"
}
```
template.yaml:
```
AWSTemplateFormatVersion: '2010-09-09'
Transform: AWS::Serverless-2016-10-31
Description: >
layers-test
Sample SAM Template for layers-test
Globals:
Function:
Timeout: 3
Resources:
HelloWorldFunction:
Type: AWS::Serverless::Function
Properties:
CodeUri: hello-world/
Handler: app.lambdaHandler
Runtime: nodejs18.x
Architectures:
- x86_64
Layers:
- !Ref SharedModulesLayer
- !Ref SharedCodeLayer
Events:
HelloWorld:
Type: Api
Properties:
Path: /hello
Method: get
SharedModulesLayer:
Type: AWS::Serverless::LayerVersion
Properties:
ContentUri: layers/shared-modules
CompatibleRuntimes:
- nodejs18.x
Metadata:
BuildMethod: nodejs18.x
BuildArchitecture: x86_64
SharedCodeLayer:
Type: AWS::Serverless::LayerVersion
Properties:
ContentUri: layers/shared-code
CompatibleRuntimes:
- nodejs18.x
```
All of this code works, but with `sam sync` active, whenever I make changes to anything in `shared-code/` I get the error:
```
Syncing Layer SharedCodeLayer...
Layer <samcli.lib.providers.sam_function_provider.SamFunctionProvider object at 0x7f19797b81d0> is missing BuildMethod Metadata.
Code sync encountered an error.
Traceback (most recent call last):
File "samcli/lib/sync/sync_flow_executor.py", line 342, in _sync_flow_execute_wrapper
File "samcli/lib/sync/sync_flow.py", line 310, in execute
File "samcli/lib/sync/flows/layer_sync_flow.py", line 224, in gather_resources
File "samcli/commands/build/build_context.py", line 523, in collect_build_resources
File "samcli/commands/build/build_context.py", line 611, in _collect_single_buildable_layer
samcli.commands.build.exceptions.MissingBuildMethodException: Build method missing in layer SharedCodeLayer.
```
If I add:
```
Metadata:
BuildMethod: nodejs18.x
BuildArchitecture: x86_64
```
to `SharedCodeLayer` then the imports no longer work. I get an error like:
```
Uncaught Exception {"errorType":"Error","errorMessage":"Cannot find module '/opt/util/util.js' imported from /var/task/app.js","code":"ERR_MODULE_NOT_FOUND","stack":["Error [ERR_MODULE_NOT_FOUND]: Cannot find module '/opt/util/util.js' imported from /var/task/app.js"," at new NodeError (node:internal/errors:393:5)"," at finalizeResolution (node:internal/modules/esm/resolve:328:11)"," at moduleResolve (node:internal/modules/esm/resolve:965:10)"," at moduleResolveWithNodePath (node:internal/modules/esm/resolve:909:12)"," at defaultResolve (node:internal/modules/esm/resolve:1173:79)"," at nextResolve (node:internal/modules/esm/loader:163:28)"," at ESMLoader.resolve (node:internal/modules/esm/loader:841:30)"," at ESMLoader.getModuleJob (node:internal/modules/esm/loader:424:18)"," at ModuleWrap.<anonymous> (node:internal/modules/esm/module_job:76:40)"," at link (node:internal/modules/esm/module_job:75:36)"]}
```
Is there any way to make these imports work while avoiding the "Build method missing in layer" in error?
I am new to AWS and I would like to learn to make some flowcharts using a mac and maybe if I can free software to play a around..
As per the title, is it possible for dev environments to automatically shutdown when not being used (or do they already do this and I haven't noticed)
I setup a codecatalyst space to investigate usage last week and it's showing that I've exceeded the free tier - at most I've used maybe 10-15 hours actively.
Hi
I want to hire a developer to work my AppStream desktop software.
I have four apps that I want to upload give use to all my customers, via internet, but I don't have time to work on that, not the expertis to do it.
ariel
I've created a simple PR against the repository hosted in my codecatalyst project (not an external repo).
When I try to merge it, it fails with the following message: `The request was denied because an input failed to satisfy the constraints specified by the service. Check the spelling and input requirements, and then try again.`
I've tried editing fields to make sure it's got a title, description etc. but seem to be stuck at this.
I'd like to customize my default "d-########.awsapps.com/start#/" SSO URL, but I'm worried it could affect production.
What will happen to this default URL? Would it still be available for my "aws configure sso" users, or will they need to update their profile to use the new one?
If the old one stays, does anyone have docs around it? I searched for days now for something.
Thanks
I setup a dev environment in codecatalyst yesterday and it would trigger vscode when I connected.
Today, tried to use it again, but when vscode is launched it fails to connect and checking the AWS Toolkit logs, I see
```
2023-01-12 17:33:44 [ERROR]: log level: info
2023-01-12 17:33:45 [INFO]: Retrieving AWS endpoint data
2023-01-12 17:33:45 [INFO]: OS: Darwin x64 22.1.0
2023-01-12 17:33:45 [INFO]: Visual Studio Code extension host: 1.74.3
2023-01-12 17:33:45 [INFO]: AWS Toolkit: 1.60.0
2023-01-12 17:33:45 [INFO]: node: 16.14.2
2023-01-12 17:33:45 [INFO]: electron: 19.1.8
2023-01-12 17:33:45 [WARN]: AwsContext: no default region in credentials profile, falling back to us-east-1:
2023-01-12 17:33:45 [WARN]: CloudFormationTemplateRegistry: addWatchPattern(**/*.{yaml,yml}): no workspace
2023-01-12 17:33:45 [WARN]: CodelensRootRegistry: addWatchPattern(**/requirements.txt): no workspace
2023-01-12 17:33:45 [WARN]: CodelensRootRegistry: addWatchPattern(**/package.json): no workspace
2023-01-12 17:33:45 [WARN]: CodelensRootRegistry: addWatchPattern(**/*.csproj): no workspace
2023-01-12 17:33:45 [WARN]: CodelensRootRegistry: addWatchPattern(**/go.mod): no workspace
2023-01-12 17:33:45 [WARN]: CodelensRootRegistry: addWatchPattern(**/build.gradle): no workspace
2023-01-12 17:33:45 [WARN]: CodelensRootRegistry: addWatchPattern(**/pom.xml): no workspace
2023-01-12 17:33:52 [WARN]: auth (codecatalyst): removing saved connection "codecatalyst.savedConnectionId" as it no longer exists
2023-01-12 17:33:52 [ERROR]: aws.codecatalyst.openDevEnv: Error: Connection is invalid or expired. Try logging in again. [InvalidConnection]
2023-01-12 17:36:21 [ERROR]: aws.codecatalyst.openDevEnv: Error: Connection is invalid or expired. Try logging in again. [InvalidConnection]
2023-01-12 17:38:46 [INFO]: telemetry: sent batch (size=20)
2023-01-12 17:38:46 [INFO]: telemetry: sent batch (size=14)
2023-01-12 17:41:23 [ERROR]: aws.codecatalyst.createDevEnv: Error: Connection is invalid or expired. Try logging in again. [InvalidConnection]
2023-01-12 17:43:46 [INFO]: telemetry: sent batch (size=13)
```
I've tried
* uninstalling and re-installing the AWS Toolkit extension,
* creating a new dev environment in codecatalyst
* clicking on the builder ID icon in AWS Toolkit extension
* Logging out and back in to codecatalyst.aws with builder id
and none of them worked. Any suggestions?
I have a CDK project where we wrap all our resources in the Pipeline construct. Prior to adding the pipeline, we could run `cdk diff` locally to view changes to the resources we were deploying. Now that we use the Pipeline construct, running diff's locally only results in changes to the pipeline construct being displayed. Is there any way other fiddling with the pipeline construct to view diff's of the application resources and not the pipeline?
Hello, I am somewhat new to CDK. Or at least I haven't came across this problem.
**Problem:** I created a stack in CDK and accidentally named it the wrong file. I also unwillingly used a module that I was not suppose to use for my particular use case. I now need to refactor the code in the stack to create resources without the module. I also need to rename the file. For example, I created an S3 bucket. I didn't add an event notificaiton. Now I want to add an event notification on the existing S3 bucket that I already created, in my new refactored code.
**Goal: ** The solution I'm looking to achieve is to update the existing stack I created with the new code and same resources except a few different parameters, without redeploying separate resources as a separate entity. Is there a way I can make configuration changes to my existing S3 bucket by just updating the stack, despite the file name changed?
I am trying to use websockets. My questions is if the connection between client and server is closed, will the notifications still be attempted? If not is there a way for me to receive the missed notifications when the connection opens again?
Hi All. Does anyone know how to configure private registry in EKS(1.24) which uses containerd? we previously used to set this up using a node template which would add the private registry into the daemon.json file during creation, is the a similar way we could achieve this?