AWS Lambda Extension throws exit status 127 (/usr/bin/env: node : No such file or directory) - amazon-web-services

I am creating a Lambda extension to get secret values from secret manager using as a template:
https://github.com/hariohmprasath/aws-lambda-extensions
I have zipped the files into the following structure.
extension.zip
--> extensions
--> secret-extension
--> secret-extension
--> node_modules
--> extensions-api.js
--> index.js
--> package.json
--> package-lock.json
--> secrets.js
Error:
{
"errorMessage": "RequestId: e5c06575-cf7d-46c0-b168-624e8e9cf572 Error: exit status 127",
"errorType": "Extension.Crash"
}
The Error is that /usr/bin/env: node : No such file or directory
At the top of the index.js file is the command #!/usr/bin/env node (in order to interpret the file in node)
The runtime environment is Nodejs 12 and have tried with 14 as well.(extension documentation says node 12 runtime is required)
What could be causing this issue?
The lambda runtime is a node runtime so node should be installed.
I have ls the folder and /env folder exists.
I know node exists within the runtime as node -v returns v14.20.0 or v12.22.11
I am on a windows machine
creating the extension (dont think the deployment could be causing
this because it was written on windows machine.
Any help would be appreciated.

So found out it has to do with a custom environment they are using for the example provided by AWS. Instead I went the route of using a runtime independent solution which has worked as expected.
Documentation

I suspect the issue you may have been encountering is the same as mine, and that issue was:
The #!/usr/bin/env node had the whitespace characters \r\n at the end of the line which obviously cannot be seen unless you have your editor display these, and this is how windows handles new lines (*nix systems use just \n); Now when the lambda reads the line, it is trying to interpret it as #!/usr/bin/env node\r which obviously won't exist, and can't run the file via node.
The problem with the logs is when you look at the logs, it won't render the \r as that, it could do 1 of 2 things depending on where you look at the logs:
It will interpret \r as a new line character, and thereby just print the whitespace, which is not obvious in the log message; OR the other situation that can occur (which is what happened to me):
It shows just : No such file or directory because it's interpreted the \r as a carriage return, which means it takes the cursor to the beginning of the line, and overwrites as it prints the new characters,
I am pretty confident this is your issue, and I will admit I didn't solve this 100% on my own as a person in my team had a similar issue with whitespace characters and only after allot of head banging did I think of it, and confirmed using hexdump -C to confirm the issue.

Related

Problem using magenta to generate song: SyntaxError: (unicode error) 'unicodeescape'

I want to generate music with magenta and a neural network model for a project.
I found this simple example and wanted to try it first to understand how it works: https://www.twilio.com/blog/training-a-neural-network-on-midi-music-data-with-magenta-and-python
Apparently i have to modify the type of my inital data (which is midi file) "in note to sequences"
Here is what i have:
convert_dir_to_note_sequences \
--input_dir == 'C:\Users\mista\Downloads\CLEANED_DATA\CLEANED_DATA' \
--output_file = tmp/notesequences.tfrecord \
--recursive
and here is the error i get:
File "C:\Users\mista\AppData\Local\Temp/ipykernel_28328/3757950315.py", line 3
--output_file = tmp/notesequences.tfrecord
^
SyntaxError: (unicode error) 'unicodeescape' codec can't decode bytes in position 2-3: truncated \UXXXXXXXX escape
I saw some people saying that you could use an 'r' before your path to solve this but i've tried many ways, i'm still stuck
I am following the same tutorial and after a couple hours of bashing my head against the keyboard, I managed to run the neural net properly. It seems like the problem is a lot of conflicting dependencies and deprecations, so you may have to play around with what version of Python you're using once you set everything else up properly (I used Python 3.7 and did pip install magenta).
I used Powershell (right click on Windows home button --> run Powershell as admin). You'll want to set up a virtual environment in your current working directory, as the tutorial advises. And now we get to your problem in particular - make sure you're running the command all in one line, as such:
convert_dir_to_note_sequences --input_dir == 'C:\Users\mista\Downloads\CLEANED_DATA\CLEANED_DATA' --output_file = tmp/notesequences.tfrecord --recursive
That should start converting all the midi files to NoteSequences objects. If you have any more trouble, please follow up and I'll see what I can do to help.

Getting "unmarshal failed" when trying to create first website post in Hugo after installation

I'm following the instructions at Hugo's Quickstart guide (https://gohugo.io/getting-started/quick-start/) but I keep getting this error message when I try to create a post:
unmarshal failed: Near line 1 (last key parsed 'theme'): expected value but found '\\' instead
I've posted some lines of my code below. The error message appears at the bottom. Could anyone help point out what I am doing wrong?
C:\Users\Scott\quickstart\MyHugoBlog\themes>git init
Initialized empty Git repository in C:/Users/Scott/quickstart/MyHugoBlog/themes/.git/
C:\Users\Scott\quickstart\MyHugoBlog\themes>git submodule add https://github.com/dashdashzako/paperback.git
Cloning into 'C:/Users/Scott/quickstart/MyHugoBlog/themes/paperback'...
remote: Enumerating objects: 16, done.
remote: Counting objects: 100% (16/16), done.
remote: Compressing objects: 100% (15/15), done.
remote: Total 194 (delta 3), reused 9 (delta 1), pack-reused 178 eceiving objects: 53% (103/194)
Receiving objects: 100% (194/194), 466.30 KiB | 5.62 MiB/s, done.
Resolving deltas: 100% (93/93), done.
warning: LF will be replaced by CRLF in .gitmodules.
The file will have its original line endings in your working directory
C:\Users\Scott\quickstart\MyHugoBlog\themes>echo theme = \"paperback\" >> config.toml
C:\Users\Scott\quickstart\MyHugoBlog\themes>hugo new posts/my-first-post.md
Error: "C:\Users\Scott\quickstart\MyHugoBlog\themes\config.toml:1:1": unmarshal failed: Near line 1 (last key parsed 'theme'): expected value but found '\\' instead
It looks like you're following instructions meant for Unix-like systems on Windows. This command isn't doing what you want:
echo theme = \"paperback\" >> config.toml
Using Bash on Linux, for example, this appends
theme = "paperback"
to your config.toml file, creating it if necessary. That's what Hugo expects to find in the file.
However, using cmd.exe on Windows I get the backslashes included:
theme = \"paperback\"
And using PowerShell, I get something even stranger:
theme
=
\paperback\
Neither of these looks like valid TOML to me, and both contain extraneous backslashes as referenced in your error message. I suggest you simply edit config.toml using your favourite text editor and add the expected
theme = "paperback"
line manually.
The issue on my end was that the file wasn't created as UTF-8
Delete the config.toml file and recreate it manually on your text editor, then paste the content like: theme = "ananke"
should work

Getting FR_3085 ERROR when working in Informatica

In a lot of the task flow jobs I'm running, I constantly am getting the
FR_3085 ERROR: Row [1]: 2-th character is a null character, which is
not allowed in a text input file
error. These occur usually in data synchronization tasks but I sometimes see this in mapping configurations as well. How do I resolve this error?
This error occurs when you have NULL characters in your flat file.
One way for doing this is using the OS utilities for removing the NULL characters from your flat file automatically and this will depend on what OS you're using.

Immuconf with Clojure not handling tree config files

Whenever I add a third config file to my .immuconf.edn I get:
No configuration files were specified, and neither an .immuconf.edn file nor
an IMMUCONF_CFG environment variable was found
This is driving me crazy since I cant really find anything wrong.
Using this loads thing OK:
["configs/betfair.edn" "configs/web-server.edn"]
however this generated an error:
["configs/betfair.edn" "configs/web-server.edn" "~/betfair.edn"]
This is the content of betfair.edn
{:betfair {:usr "..."
:pwd "..."
:app-key "..." ;; key used
:app-key-live "..."
:app-key-test "..."}}
(where ... is replaced with actual strings)
Why am I getting this error when adding the third file and how can I fix this?
Make sure that the last file specified in your <project dir>/.immuconf.edn (~/betfair.edn) exists in your home directory.
Immuconf does some magic to replace ~ in filenames specified in .immuconf.edn with a value of (System/getProperty "user.home") so you might check if that system property points to the same directory where your ~/betfair.edn file is located.
I have recreated your setup and it works on my machine so it is probably a problem with locations or access rights to your files. Unfortunately, error handling for the no arg invocation of (immuconf.config/load) doesn't help in troubleshooting as it swallows any exceptions and returns nil. That exception would probably tell you what kind of error occured (some file not found or some IO error happened). You might want to file a pull request with a patch to log such errors as warnings instead of ignoring them.

hadoop mapreduce job is not running

i have created a basic mapreduce program and created jar file out of it. when i am trying to run it from console like:
[cloudera#localhost ~]$ hadoop jar /home/cloudera/Desktop/csvjar.jar testpackage.Mapreduce /import/climate /output5
Nothing is happening, no error or map reduce status. It just displays
[cloudera#localhost ~]
Mapreduce is the class where map, reduce and main function resides. Jar file kept on local machine and HDFS also. I have tried with both the paths. Nothing happened in both the conditions. Output5 folder does not exist in the hdfs.
I also came through the same issue. In my code, I missed the closing braces while checking the arguments section in the driver code. I am attaching the part of the code with "}" for reference.
if(otherArgs.length !=3){
System.err.println("Number of argument passed is not 3");
System.exit(1);
}
I hope this would help you.