Hello,
We're hitting some issues with dynamic library dependencies of a lambda deployed via this library.
I included as much details as I could gather (sorry if it's too much). Any help on this would be appreciated 😃
When I deploy the lambda by running npx sls deploy
and do a test run of it in AWS, I'm getting the following error:
START RequestId: 07ef6bc4-ef85-49bf-82eb-8a73a1e313c3 Version: $LATEST
./r-executor-cleanup: /lib64/libldap_r-2.4.so.2: no version information available (required by /var/task/libpq.so.5)
./r-executor-cleanup: /lib64/libm.so.6: version `GLIBC_2.23' not found (required by /var/task/libquadmath.so.0)
END RequestId: 07ef6bc4-ef85-49bf-82eb-8a73a1e313c3
REPORT RequestId: 07ef6bc4-ef85-49bf-82eb-8a73a1e313c3 Duration: 26.71 ms Billed Duration: 100 ms Memory Size: 1024 MB Max Memory Used: 6 MB
RequestId: 07ef6bc4-ef85-49bf-82eb-8a73a1e313c3 Error: Runtime exited with error: exit status 1 Runtime.ExitError
The lambda looks like this so far (but the binary has all our required haskell dependencies)
module Our.Module.Name where
import AWSLambda (lambdaMain)
import Data.Aeson (Value)
lambda :: IO ()
lambda = lambdaMain cleanupHandler
cleanupHandler :: Value -> IO ()
cleanupHandler _ = putTextLn "TODO implement me"
build environment
We tested building the lambda in couple of environments, each time the error we got when running Test in aws was the same:
- Linux 5.8.8, Fedora 32
- Linux 5.4.62, NixOS 21.03
- MacOS
We're building our project using stack lts-16.2,
we tried both with serverless-haskell 0.11.3 (included in the lts-16.2 snapshot) as well as with the latest version from hackage (0.12.1 - added to stack.yaml inside extra-deps
)
Our package.json looks like this:
package.json
{
"name": "pi-haskell-lambdas",
"version": "0.1.0",
"description": "Config for building and deploying haskell lambdas via serverless framework",
"directories": {
"test": "test"
},
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "",
"license": "ISC",
"dependencies": {
"serverless": "^1.83.0",
"serverless-haskell": "^0.12.1"
}
}
Addition info + things we tried:
As for the two .so files mentioned in the error log:
libpq.so.5 - is dependency of postgresql-simple that we're using
libquadmath.so.0 - this is dependency of some of the linear algebra / machine learning libs our app is using
Which files end up in the .serverless/r-executor-cleanup.zip ?
$ unzip .serverless/r-executor-cleanup.zip
$ ldd r-executor-cleanup # This is our main binary packaged in the zip
linux-vdso.so.1 (0x00007ffc1b37f000)
libm.so.6 => /lib64/libm.so.6 (0x00007fedba2e3000)
libpthread.so.0 => /lib64/libpthread.so.0 (0x00007fedba2c1000)
libpq.so.5 => /lib64/libpq.so.5 (0x00007fedba270000)
libutil.so.1 => /lib64/libutil.so.1 (0x00007fedba26b000)
libblas.so.3 => /lib64/libblas.so.3 (0x00007fedba214000)
liblapack.so.3 => /lib64/liblapack.so.3 (0x00007fedb9b69000)
libgsl.so.19 => not found
libgslcblas.so.0 => /lib64/libgslcblas.so.0 (0x00007fedb9b24000)
libz.so.1 => /lib64/libz.so.1 (0x00007fedb9b0a000)
librt.so.1 => /lib64/librt.so.1 (0x00007fedb9aff000)
libdl.so.2 => /lib64/libdl.so.2 (0x00007fedb9af8000)
libgmp.so.10 => /lib64/libgmp.so.10 (0x00007fedb9a61000)
libc.so.6 => /lib64/libc.so.6 (0x00007fedb9895000)
/lib64/ld-linux-x86-64.so.2 (0x00007fedba449000)
libssl.so.1.1 => /lib64/libssl.so.1.1 (0x00007fedb97fe000)
libcrypto.so.1.1 => /lib64/libcrypto.so.1.1 (0x00007fedb9511000)
libgssapi_krb5.so.2 => /lib64/libgssapi_krb5.so.2 (0x00007fedb94ba000)
libldap_r-2.4.so.2 => /lib64/libldap_r-2.4.so.2 (0x00007fedb9460000)
libgfortran.so.5 => /lib64/libgfortran.so.5 (0x00007fedb9195000)
libkrb5.so.3 => /lib64/libkrb5.so.3 (0x00007fedb90a8000)
libk5crypto.so.3 => /lib64/libk5crypto.so.3 (0x00007fedb908f000)
libcom_err.so.2 => /lib64/libcom_err.so.2 (0x00007fedb9088000)
libkrb5support.so.0 => /lib64/libkrb5support.so.0 (0x00007fedb9076000)
libkeyutils.so.1 => /lib64/libkeyutils.so.1 (0x00007fedb906f000)
libresolv.so.2 => /lib64/libresolv.so.2 (0x00007fedb9055000)
liblber-2.4.so.2 => /lib64/liblber-2.4.so.2 (0x00007fedb9042000)
libsasl2.so.3 => /lib64/libsasl2.so.3 (0x00007fedb9022000)
libquadmath.so.0 => /lib64/libquadmath.so.0 (0x00007fedb8fd8000)
libgcc_s.so.1 => /lib64/libgcc_s.so.1 (0x00007fedb8fbd000)
libselinux.so.1 => /lib64/libselinux.so.1 (0x00007fedb8f90000)
libcrypt.so.2 => /lib64/libcrypt.so.2 (0x00007fedb8f53000)
libpcre2-8.so.0 => /lib64/libpcre2-8.so.0 (0x00007fedb8eba000)
What version of GLIBC do the ".so" files depend on?
$ for binary in r-executor-cleanup *.so.*; do echo $binary; objdump -T $binary | grep -o -E 'GLIBC_[0-9.]+' | sort -u; done
r-executor-cleanup
GLIBC_2.10
GLIBC_2.12
GLIBC_2.14
GLIBC_2.2.5
GLIBC_2.3
GLIBC_2.3.2
GLIBC_2.3.4
GLIBC_2.7
GLIBC_2.8
libasn1.so.8
GLIBC_2.14
GLIBC_2.2.5
GLIBC_2.3.4
GLIBC_2.4
GLIBC_2.8
libblas.so.3
GLIBC_2.2.5
GLIBC_2.3
GLIBC_2.3.4
GLIBC_2.4
libcrypto.so.1.0.0
GLIBC_2.14
GLIBC_2.2.5
GLIBC_2.3
GLIBC_2.3.4
GLIBC_2.4
GLIBC_2.7
libcrypt.so.1
GLIBC_2.14
GLIBC_2.2.5
libgfortran.so.3
GLIBC_2.14
GLIBC_2.17
GLIBC_2.2.5
GLIBC_2.3
GLIBC_2.3.4
GLIBC_2.4
GLIBC_2.6
GLIBC_2.7
libgnutls.so.30
GLIBC_2.14
GLIBC_2.15
GLIBC_2.17
GLIBC_2.2.5
GLIBC_2.3
GLIBC_2.3.2
GLIBC_2.3.4
GLIBC_2.4
GLIBC_2.8
libgslcblas.so.0
GLIBC_2.2.5
GLIBC_2.3.4
libgsl.so.19
GLIBC_2.14
GLIBC_2.2.5
GLIBC_2.3.4
GLIBC_2.4
GLIBC_2.7
libgssapi.so.3
GLIBC_2.14
GLIBC_2.2.5
GLIBC_2.3
GLIBC_2.4
GLIBC_2.8
libhcrypto.so.4
GLIBC_2.14
GLIBC_2.2.5
GLIBC_2.3
GLIBC_2.3.4
GLIBC_2.4
GLIBC_2.7
libheimbase.so.1
GLIBC_2.14
GLIBC_2.2.5
GLIBC_2.3
GLIBC_2.3.4
GLIBC_2.4
GLIBC_2.8
libheimntlm.so.0
GLIBC_2.2.5
GLIBC_2.3
GLIBC_2.4
libhogweed.so.4
GLIBC_2.14
GLIBC_2.2.5
GLIBC_2.4
libhx509.so.5
GLIBC_2.14
GLIBC_2.2.5
GLIBC_2.3
GLIBC_2.3.4
GLIBC_2.4
GLIBC_2.8
libidn.so.11
GLIBC_2.14
GLIBC_2.2.5
GLIBC_2.4
libkrb5.so.26
GLIBC_2.14
GLIBC_2.15
GLIBC_2.2.5
GLIBC_2.3
GLIBC_2.3.2
GLIBC_2.3.4
GLIBC_2.4
GLIBC_2.7
GLIBC_2.8
liblapack.so.3
GLIBC_2.14
GLIBC_2.2.5
GLIBC_2.4
liblber-2.4.so.2
GLIBC_2.14
GLIBC_2.2.5
GLIBC_2.3
GLIBC_2.3.4
GLIBC_2.4
libldap_r-2.4.so.2
GLIBC_2.12
GLIBC_2.14
GLIBC_2.2.5
GLIBC_2.3
GLIBC_2.3.2
GLIBC_2.3.4
GLIBC_2.4
libnettle.so.6
GLIBC_2.14
GLIBC_2.2.5
GLIBC_2.3.4
GLIBC_2.4
libpq.so.5
GLIBC_2.14
GLIBC_2.2.5
GLIBC_2.3
GLIBC_2.3.4
GLIBC_2.4
libquadmath.so.0
GLIBC_2.10
GLIBC_2.14
GLIBC_2.23
GLIBC_2.2.5
GLIBC_2.3
GLIBC_2.3.4
GLIBC_2.4
libroken.so.18
GLIBC_2.14
GLIBC_2.15
GLIBC_2.16
GLIBC_2.2.5
GLIBC_2.3
GLIBC_2.3.4
GLIBC_2.4
GLIBC_2.8
libsasl2.so.2
GLIBC_2.14
GLIBC_2.15
GLIBC_2.2.5
GLIBC_2.3
GLIBC_2.3.4
GLIBC_2.4
libsqlite3.so.0
GLIBC_2.14
GLIBC_2.2.5
GLIBC_2.3.4
GLIBC_2.4
libssl.so.1.0.0
GLIBC_2.14
GLIBC_2.2.5
GLIBC_2.3.4
GLIBC_2.4
libwind.so.0
GLIBC_2.14
GLIBC_2.2.5
GLIBC_2.3.4
GLIBC_2.4
Where do the .so files, that end up in the zip package come from?
I added some logging between these 2 lines and this is what I get as part of npx sls package
:
output
$ npx sls package
Serverless: Building handler r-executor-cleanup with Stack...
# ...
# stack build log omitted
Serverless: Running stack exec cp /usr/lib/x86_64-linux-gnu/libpq.so.5 /home/jhrcek/Devel/github.com/Holmusk/PI/backend/libpq.so.5
Serverless: Running stack exec cp /usr/lib/libblas.so.3 /home/jhrcek/Devel/github.com/Holmusk/PI/backend/libblas.so.3
Serverless: Running stack exec cp /usr/lib/liblapack.so.3 /home/jhrcek/Devel/github.com/Holmusk/PI/backend/liblapack.so.3
Serverless: Running stack exec cp /usr/lib/x86_64-linux-gnu/libgsl.so.19 /home/jhrcek/Devel/github.com/Holmusk/PI/backend/libgsl.so.19
Serverless: Running stack exec cp /usr/lib/x86_64-linux-gnu/libgslcblas.so.0 /home/jhrcek/Devel/github.com/Holmusk/PI/backend/libgslcblas.so.0
Serverless: Running stack exec cp /lib/x86_64-linux-gnu/libssl.so.1.0.0 /home/jhrcek/Devel/github.com/Holmusk/PI/backend/libssl.so.1.0.0
Serverless: Running stack exec cp /lib/x86_64-linux-gnu/libcrypto.so.1.0.0 /home/jhrcek/Devel/github.com/Holmusk/PI/backend/libcrypto.so.1.0.0
Serverless: Running stack exec cp /usr/lib/x86_64-linux-gnu/libldap_r-2.4.so.2 /home/jhrcek/Devel/github.com/Holmusk/PI/backend/libldap_r-2.4.so.2
Serverless: Running stack exec cp /usr/lib/x86_64-linux-gnu/libgfortran.so.3 /home/jhrcek/Devel/github.com/Holmusk/PI/backend/libgfortran.so.3
Serverless: Running stack exec cp /usr/lib/x86_64-linux-gnu/liblber-2.4.so.2 /home/jhrcek/Devel/github.com/Holmusk/PI/backend/liblber-2.4.so.2
Serverless: Running stack exec cp /usr/lib/x86_64-linux-gnu/libsasl2.so.2 /home/jhrcek/Devel/github.com/Holmusk/PI/backend/libsasl2.so.2
Serverless: Running stack exec cp /usr/lib/x86_64-linux-gnu/libgssapi.so.3 /home/jhrcek/Devel/github.com/Holmusk/PI/backend/libgssapi.so.3
Serverless: Running stack exec cp /usr/lib/x86_64-linux-gnu/libgnutls.so.30 /home/jhrcek/Devel/github.com/Holmusk/PI/backend/libgnutls.so.30
Serverless: Running stack exec cp /usr/lib/x86_64-linux-gnu/libquadmath.so.0 /home/jhrcek/Devel/github.com/Holmusk/PI/backend/libquadmath.so.0
Serverless: Running stack exec cp /usr/lib/x86_64-linux-gnu/libheimntlm.so.0 /home/jhrcek/Devel/github.com/Holmusk/PI/backend/libheimntlm.so.0
Serverless: Running stack exec cp /usr/lib/x86_64-linux-gnu/libkrb5.so.26 /home/jhrcek/Devel/github.com/Holmusk/PI/backend/libkrb5.so.26
Serverless: Running stack exec cp /usr/lib/x86_64-linux-gnu/libasn1.so.8 /home/jhrcek/Devel/github.com/Holmusk/PI/backend/libasn1.so.8
Serverless: Running stack exec cp /usr/lib/x86_64-linux-gnu/libhcrypto.so.4 /home/jhrcek/Devel/github.com/Holmusk/PI/backend/libhcrypto.so.4
Serverless: Running stack exec cp /usr/lib/x86_64-linux-gnu/libroken.so.18 /home/jhrcek/Devel/github.com/Holmusk/PI/backend/libroken.so.18
Serverless: Running stack exec cp /usr/lib/x86_64-linux-gnu/libidn.so.11 /home/jhrcek/Devel/github.com/Holmusk/PI/backend/libidn.so.11
Serverless: Running stack exec cp /usr/lib/x86_64-linux-gnu/libnettle.so.6 /home/jhrcek/Devel/github.com/Holmusk/PI/backend/libnettle.so.6
Serverless: Running stack exec cp /usr/lib/x86_64-linux-gnu/libhogweed.so.4 /home/jhrcek/Devel/github.com/Holmusk/PI/backend/libhogweed.so.4
Serverless: Running stack exec cp /usr/lib/x86_64-linux-gnu/libwind.so.0 /home/jhrcek/Devel/github.com/Holmusk/PI/backend/libwind.so.0
Serverless: Running stack exec cp /usr/lib/x86_64-linux-gnu/libheimbase.so.1 /home/jhrcek/Devel/github.com/Holmusk/PI/backend/libheimbase.so.1
Serverless: Running stack exec cp /usr/lib/x86_64-linux-gnu/libhx509.so.5 /home/jhrcek/Devel/github.com/Holmusk/PI/backend/libhx509.so.5
Serverless: Running stack exec cp /usr/lib/x86_64-linux-gnu/libsqlite3.so.0 /home/jhrcek/Devel/github.com/Holmusk/PI/backend/libsqlite3.so.0
Serverless: Running stack exec cp /lib/x86_64-linux-gnu/libcrypt.so.1 /home/jhrcek/Devel/github.com/Holmusk/PI/backend/libcrypt.so.1
Serverless: Packaging service...
The issue is reproducible locally
When I run npx sls invoke local -f r-executor-cleanup
locally
I see an active docker container, which seems to be doing nothing (for 30 minutes).
docker ps -a --no-trunc
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
cfdb5dcd255da7edbbdd25cc0f5769aa6f99278493406df80befc0003e7d93a4 sls-docker-provided "/var/runtime/init ./r-executor-cleanup \"\"" 58 seconds ago Up 57 seconds distracted_blackburn
And when I do docker kill <CONTAINER_ID>
the following appears in terminal, where I executed the above command:
output
Serverless: Packaging service...
# At this point I execute `docker kill...`
./r-executor-cleanup: /lib64/libldap_r-2.4.so.2: no version information available (required by /var/task/libpq.so.5)
./r-executor-cleanup: /lib64/libm.so.6: version `GLIBC_2.23' not found (required by /var/task/libquadmath.so.0)
Error --------------------------------------------------
Error: Failed to run docker for provided image (exit code 137})
at /home/jhrcek/Devel/github.com/Holmusk/PI/backend/node_modules/serverless/lib/plugins/aws/invokeLocal/index.js:537:21
at processTicksAndRejections (internal/process/task_queues.js:97:5)
For debugging logs, run again after setting the "SLS_DEBUG=*" environment variable.
Get Support --------------------------------------------
Docs: docs.serverless.com
Bugs: github.com/serverless/serverless/issues
Issues: forum.serverless.com
Your Environment Information ---------------------------
Operating System: linux
Node Version: 12.16.1
Framework Version: 1.83.0 (local)
Plugin Version: 3.8.4
SDK Version: 2.3.1
Components Version: 2.34.9
Note that this corresponds to the error we're getting when testing the lambda in AWS console.
/var/task
is owned by aws_user:1000
now, but lambci/lambda:build-provided.al2
runs as sbx_user1051
, which makes sls offline start
die with permission errors like not being able to access /var/task
.
How can this be rectified?
Using sls yaml config:
plugins:
- serverless-haskell
- serverless-offline
custom:
haskell:
docker: true
serverless-offline:
useDocker: true
printOutput: true
Ta!
Should leave the Haskell process running and communicate to it via sockets or even HTTP requests.
Hello,
I am trying to run the example project on macOS Mojave (10.14.04).
I am getting the following error:
uk05182:haskelllambda jakob$ stack install
serverless-haskell-0.8.7: configure
serverless-haskell-0.8.7: build
Progress 1/2
-- While building package serverless-haskell-0.8.7 using:
/Users/jakob/.stack/setup-exe-cache/x86_64-osx/Cabal-simple_mPHDZzAJ_2.4.0.1_ghc-8.6.4 --builddir=.stack-work/dist/x86_64-osx/Cabal-2.4.0.1 build --ghc-options " -ddump-hi -ddump-to-file -fdiagnostics-color=always"
Process exited with code: ExitFailure 1
Logs have been written to: /Users/jakob/private_projects/haskelllambda/.stack-work/logs/serverless-haskell-0.8.7.log
Configuring serverless-haskell-0.8.7...
Preprocessing library for serverless-haskell-0.8.7..
Building library for serverless-haskell-0.8.7..
[ 1 of 13] Compiling AWSLambda.Events.Records ( src/AWSLambda/Events/Records.hs, .stack-work/dist/x86_64-osx/Cabal-2.4.0.1/build/AWSLambda/Events/Records.o )
<command line>: can't load .so/.DLL for: /Users/jakob/.stack/snapshots/x86_64-osx/lts-13.19/8.6.4/lib/x86_64-osx-ghc-8.6.4/libHSzlib-0.6.2-BdOecmQ0rL1HOiGypdSgxY-ghc8.6.4.dylib (dlopen(/Users/jakob/.stack/snapshots/x86_64-osx/lts-13.19/8.6.4/lib/x86_64-osx-ghc-8.6.4/libHSzlib-0.6.2-BdOecmQ0rL1HOiGypdSgxY-ghc8.6.4.dylib, 5): Symbol not found: _deflateEnd
Referenced from: /Users/jakob/.stack/snapshots/x86_64-osx/lts-13.19/8.6.4/lib/x86_64-osx-ghc-8.6.4/libHSzlib-0.6.2-BdOecmQ0rL1HOiGypdSgxY-ghc8.6.4.dylib
Expected in: flat namespace
in /Users/jakob/.stack/snapshots/x86_64-osx/lts-13.19/8.6.4/lib/x86_64-osx-ghc-8.6.4/libHSzlib-0.6.2-BdOecmQ0rL1HOiGypdSgxY-ghc8.6.4.dylib)
My steps:
- Clone project
- Change resolver in
stack.yml
to lts-13.19
- Execute
stack build
or stack install
(both fail)
I tried using lts-13.11
but ran into the same issue.
Trying to go through your readme and when I get to sls deploy
I receive the following error message:
> npx sls deploy
Pulling image from registry: 'fpco/stack-build:lts-12.9'
lts-12.9: Pulling from fpco/stack-build
Digest: sha256:fdbabc6df1135ab640041c966a2f8ced3bdaff7226de4a41f52d8c08fc9d64c7
Status: Image is up to date for fpco/stack-build:lts-12.9
Serverless: Could not find serverless-haskell in stack's dependencies. Make sure serverless-haskell you are using LTS 12 (or newer), or add it as an extra-dep in your stack.yaml.
Error --------------------------------------------------
Package not found.
For debugging logs, run again after setting the "SLS_DEBUG=*" environment variable.
Get Support --------------------------------------------
Docs: docs.serverless.com
Bugs: github.com/serverless/serverless/issues
Issues: forum.serverless.com
Your Environment Information -----------------------------
OS: darwin
Node Version: 8.11.3
Serverless Version: 1.31.0
I have added the following to my stack.yaml file
extra-deps:
- serverless-haskell-0.7.5
I'm sure that this is something easy that I'm missing
I am not sure if this is related to #28, but sockets seem to hang up both when using serverless offline start
and invoke local
.
$ yarn sls offline start
Serverless: Building handler with Stack...
...
Serverless: GET /hello/bla (λ: gateway-entry)
This should go to logs
Serverless: [200] {"body":"Hello, bla\n","headers":{},"statusCode":200}
Error: socket hang up
at createHangUpError (_http_client.js:313:15)
at TLSSocket.socketOnEnd (_http_client.js:416:23)
at TLSSocket.emit (events.js:187:15)
at TLSSocket.EventEmitter.emit (domain.js:442:20)
at endReadableNT (_stream_readable.js:1081:12)
at process._tickCallback (internal/process/next_tick.js:63:19)
error Command failed with exit code 1.
$ yarn sls invoke local --function entry --data '{}'
...
This should go to logs
Object (fromList [])
"Went into handler"
Error: socket hang up
at createHangUpError (_http_client.js:313:15)
at TLSSocket.socketOnEnd (_http_client.js:416:23)
at TLSSocket.emit (events.js:187:15)
at TLSSocket.EventEmitter.emit (domain.js:442:20)
at endReadableNT (_stream_readable.js:1081:12)
at process._tickCallback (internal/process/next_tick.js:63:19)
error Command failed with exit code 1.
I'd also expect invoke local
to exit immediately after the response, but I am not sure what the intended effect is here.
Hello @koterpillar,
since amazonka 2.0 release candidate is out (brendanhay/amazonka#716)
I'd like to upgrade to it, but this will require this library to migrate to it too.
Are you planning to upgrade this library to support it?
If you're too busy, I could try opening a PR (not sure yet how much effort it would be). I opened an initial PR to help you preview the necessary changes.
Would you prefer to support both <2.0 and >=2.0 version of amazonka or would you be ok with moving to >=2.0 only?
The former would likely require lots of CPP..
I had been thinking about trying to write a wrapper process based on a node extension to address #24 and #26 but that involved a lot of strange chicanery, especially as we'd have a C shim between Node and Haskell, so it'd get gross.
If we can bind to the new C++ runtime API that seems like the easiest and best route to a genuinely native Haskell runtime.
If no one else is working on this, I'm inclined to take a shot at it, especially if it can all be done through ctypes. My inclination is to write a separate package that calls into the API rather than adding to this, unless it winds up needing some of the types already nicely defined here.
Any thoughts?
Today I tried upgrading from serverless-haskell from 0.12.5 to 0.12.6
With 0.12.5 my lambdas are building fine.
But after upgrade to 0.12.6 I started getting failures like this:
...
postgresql-libpq > Configuring postgresql-libpq-0.9.4.2...
postgresql-libpq > setup: The program 'pg_config' is required but it could not be found.
...
...
-- While building package postgresql-libpq-0.9.4.2 (scroll up to its section to see the error) using:
...
Error ---------------------------------------------------
...
Error: Error when running Stack: exit code: 1
Stack command: stack --docker --docker-image haskell:stretch --no-nix build
at new ProcessError (/home/jhrcek/Devel/github.com/Holmusk/PI/backend/node_modules/serverless-haskell/dist/index.js:76:28)
at ServerlessPlugin.runStack (/home/jhrcek/Devel/github.com/Holmusk/PI/backend/node_modules/serverless-haskell/dist/index.js:158:19)
at /home/jhrcek/Devel/github.com/Holmusk/PI/backend/node_modules/serverless-haskell/dist/index.js:276:19
at Array.forEach (<anonymous>)
at ServerlessPlugin.buildHandlers (/home/jhrcek/Devel/github.com/Holmusk/PI/backend/node_modules/serverless-haskell/dist/index.js:254:34)
at PluginManager.invoke (/home/jhrcek/Devel/github.com/Holmusk/PI/backend/node_modules/serverless/lib/classes/PluginManager.js:576:20)
at async PluginManager.run (/home/jhrcek/Devel/github.com/Holmusk/PI/backend/node_modules/serverless/lib/classes/PluginManager.js:634:7)
at async Serverless.run (/home/jhrcek/Devel/github.com/Holmusk/PI/backend/node_modules/serverless/lib/Serverless.js:427:5)
at async /home/jhrcek/Devel/github.com/Holmusk/PI/backend/node_modules/serverless/scripts/serverless.js:650:9
I suspect the reason might be this:
My application depends on postgresql-simple
, which in turn depends on libpq-devel
C library.
This dependency was probably present in the fpco/stack-build:lts-13.30
, but is no longer provided by the new haskell:stretch
image:
$ docker run -it fpco/stack-build:lts-13.30 /bin/bash
root@f4a5ce57efce:/# pkg-config --list-all | grep libpq
libpq libpq - PostgreSQL libpq library
$ docker run -it haskell:stretch /bin/bash
root@91a83277f13e:/# pkg-config --list-all | sort
form form - ncurses 6.0 add-on library
menu menu - ncurses 6.0 add-on library
ncurses ncurses - ncurses 6.0 library
ncurses++ ncurses++ - ncurses 6.0 add-on library
panel panel - ncurses 6.0 add-on library
sqlite3 SQLite - SQL database engine
tic tic - ncurses 6.0 add-on library
tinfo tinfo - ncurses 6.0 terminal interface library
zlib zlib - zlib compression library
Hi. New to Serverless so maybe I'm doing it wrong, but:
Steps
- Check out and build example project
- Verify that
sls invoke hello -d "[1, 100, 10]"
correctly returns "Highest value is 100"
- Then run
sls invoke local hello -d "[1, 100, 10]"
Expected
- Same result, i.e.
"Highest value is 100"
Actual
Errors with:
{ Error: Cannot find module '/home/nick/workspace/GITHUB/serverless-haskell/example-project/serverless-haskell-example'
at Function.Module._resolveFilename (module.js:547:15)
at Function.Module._load (module.js:474:25)
at Module.require (module.js:596:17)
at require (internal/module.js:11:18)
at AwsInvokeLocal.invokeLocalNodeJs (/home/nick/workspace/GITHUB/serverless-haskell/example-project/node_modules/serverless/lib/plugins/aws/invokeLocal/index.js:258:33)
at AwsInvokeLocal.invokeLocal (/home/nick/workspace/GITHUB/serverless-haskell/example-project/node_modules/serverless/lib/plugins/aws/invokeLocal/index.js:125:19)
at AwsInvokeLocal.tryCatcher (/home/nick/workspace/GITHUB/serverless-haskell/example-project/node_modules/bluebird/js/release/util.js:16:23)
at Promise._settlePromiseFromHandler (/home/nick/workspace/GITHUB/serverless-haskell/example-project/node_modules/bluebird/js/release/promise.js:512:31)
at Promise._settlePromise (/home/nick/workspace/GITHUB/serverless-haskell/example-project/node_modules/bluebird/js/release/promise.js:569:18)
at Promise._settlePromise0 (/home/nick/workspace/GITHUB/serverless-haskell/example-project/node_modules/bluebird/js/release/promise.js:614:10)
at Promise._settlePromises (/home/nick/workspace/GITHUB/serverless-haskell/example-project/node_modules/bluebird/js/release/promise.js:693:18)
at Async._drainQueue (/home/nick/workspace/GITHUB/serverless-haskell/example-project/node_modules/bluebird/js/release/async.js:133:16)
at Async._drainQueues (/home/nick/workspace/GITHUB/serverless-haskell/example-project/node_modules/bluebird/js/release/async.js:143:10)
at Immediate.Async.drainQueues (/home/nick/workspace/GITHUB/serverless-haskell/example-project/node_modules/bluebird/js/release/async.js:17:14)
at runCallback (timers.js:794:20)
at tryOnImmediate (timers.js:752:5)
at processImmediate [as _immediateCallback] (timers.js:729:5) code: 'MODULE_NOT_FOUND' }
Done in 0.66s.
I'm not sure if I'm missing any steps, but I'm unable to run sls deploy
on either my own project or the example one, with the same error:
sls deploy -v
Pulling image from registry: 'fpco/stack-build:lts-9.17'
lts-9.17: Pulling from fpco/stack-build
Digest: sha256:d01545998a8bf2407e3c0e3c2c4b5fa5d00bd9fe449f5d4be388445d6dada741
Status: Image is up to date for fpco/stack-build:lts-9.17
Type Error ---------------------------------------------
fs.copyFileSync is not a function
I've tried first doing
npm install
from example-project
npm install
from serverless-plugin
npm install -g fs-extra
- manually running
stack build --docker
from example-project first
I have written a simple servant
server and converted it into a lambda function that queries a MySQL
db in amazon RDS. I can get it to work locally with serverless offline start
however when I deploy it (serverless deploy
) I get the following error in my dashboard when trying to access my simple test endpoint.
10:24:00 am
START RequestId: 9577f510-712c-4204-b9ac-05d75defcb42 Version: $LATEST
10:24:00 am
2019-10-28T14:24:00.167Z 9577f510-712c-4204-b9ac-05d75defcb42 INFO
10:24:00 am
2019-10-28T14:24:00.169Z 9577f510-712c-4204-b9ac-05d75defcb42 ERROR ReferenceError: exe is not defined
at Object.<anonymous> (/var/task/s_apigw.js:14:66)
at Module._compile (internal/modules/cjs/loader.js:778:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:789:10)
at Module.load (internal/modules/cjs/loader.js:653:32)
at tryModuleLoad (internal/modules/cjs/loader.js:593:12)
at Function.Module._load (internal/modules/cjs/loader.js:585:3)
at Module.require (internal/modules/cjs/loader.js:692:17)
at require (internal/modules/cjs/helpers.js:25:18)
at _tryRequire (/var/runtime/UserFunction.js:75:12)
at _loadUserApp (/var/runtime/UserFunction.js:95:12)
10:24:00 am
2019-10-28T14:24:00.185Z 9577f510-712c-4204-b9ac-05d75defcb42 ERROR Invoke Error {
"errorType": "ReferenceError",
"errorMessage": "exe is not defined",
"stack": [
"ReferenceError: exe is not defined",
" at Object.<anonymous> (/var/task/s_apigw.js:14:66)",
" at Module._compile (internal/modules/cjs/loader.js:778:30)",
" at Object.Module._extensions..js (internal/modules/cjs/loader.js:789:10)",
" at Module.load (internal/modules/cjs/loader.js:653:32)",
" at tryModuleLoad (internal/modules/cjs/loader.js:593:12)",
" at Function.Module._load (internal/modules/cjs/loader.js:585:3)",
" at Module.require (internal/modules/cjs/loader.js:692:17)",
" at require (internal/modules/cjs/helpers.js:25:18)",
" at _tryRequire (/var/runtime/UserFunction.js:75:12)",
" at _loadUserApp (/var/runtime/UserFunction.js:95:12)"
]
}
10:24:00 am
END RequestId: 9577f510-712c-4204-b9ac-05d75defcb42
10:24:00 am
REPORT RequestId: 9577f510-712c-4204-b9ac-05d75defcb42 Duration: 30.73 ms Billed Duration: 100 ms Memory Size: 1024 MB Max Memory Used: 83 MB Init Duration: 210.80 ms
stack new serverless-haskell
should produce a project ready to be deployed. Note: no new Stack templates are currently accepted pending a refactor.
Hi,
I wonder if it would be possible to add support for serverless-offline. It would be awesome to be able to develop a haskell lambda locally with all the available plugins. :)
Whats your opinion?
Thanks!
I'm currently getting this error from my AWS apigateway api using Postman:
{
"errorType": "Error",
"errorMessage": "child process output bad JSON: ",
"stack": [
"Error: child process output bad JSON: ",
" at _homogeneousError (/var/runtime/CallbackContext.js:13:12)",
" at postError (/var/runtime/CallbackContext.js:30:51)",
" at done (/var/runtime/CallbackContext.js:57:7)",
" at fail (/var/runtime/CallbackContext.js:69:7)",
" at /var/runtime/CallbackContext.js:105:16",
" at process._tickCallback (internal/process/next_tick.js:68:7)"
]
My json payload is as follows:
{ "resource" : "/updatepic"
, "body" : "pleasework"}
My end point is: https://xxxxxxxxx.execute-api.us-east-1.amazonaws.com/dev/updatepic
I'm not sure if I'm formatting my JSON payload correctly. I've tried many variations but I'm getting timeouts and the bad JSON error above.
If I don't put any payload in my POST request my lamba function continues to execution and outputs "not enough input"/
This is my "event" JSON parser:
instance FromJSON Event where
parseJSON = withObject "Event" $ \v -> do
bd <- v .: "body"
rs <- v .: "resource"
pure $ Event bd rs
And this is my serverless.yml
service: hailmeout-production
provider:
name: aws
runtime: haskell
region: us-east-1
timeout: 30
functions:
servantserver:
handler: servantBackend.backend
events:
- http:
path: updatepic
method: post
cors: true
plugins:
- serverless-haskell
- serverless-offline
Can we get it to allow non-normally-versioned Dockers?
npx sls deploy
output:
Error: Error when running Stack: Cannot get Docker version (invalid 'docker --version' output)
docker --version
output:
Docker version master-dockerproject-2019-07-12, build 6fc0dc91
Docker installed via:
curl -sSL https://get.docker.com/rootless | sh
Ta!
Starting from Stack 1.7, stack list-dependencies
is deprecated in favor of stack ls dependencies
:
offline: Warning: found unsupported runtime 'haskell' for function 'emailme'
No valid trust data for haskell
offline: Failure: Command failed with exit code 1: docker pull --disable-content-trust=false lambci/lambda:haskell
No valid trust data for haskell
Error: Command failed with exit code 1: docker pull --disable-content-trust=false lambci/lambda:haskell
No valid trust data for haskell
at makeError (/home/dwd/code/mine/projects/haskell/slsdemo/node_modules/serverless-offline/node_modules/execa/lib/error.js:59:11)
at handlePromise (/home/dwd/code/mine/projects/haskell/slsdemo/node_modules/serverless-offline/node_modules/execa/index.js:114:26)
at processTicksAndRejections (internal/process/task_queues.js:97:5)
at Function._pullImage (/home/dwd/code/mine/projects/haskell/slsdemo/node_modules/serverless-offline/dist/lambda/handler-runner/docker-runner/DockerImage.js:35:7)
Tried to use provided
as runtime but I just get:
offline: [502] {"errorType":"exitError","errorMessage":"RequestId: 2cf06505-d533-17c1-57a0-edde6a345edc Error: Couldn't find valid bootstrap(s): [/var/task/bootstrap /opt/bootstrap]"}
Any ideas?
Hey there - first off: thanks for this nice techology.
Unfortunately I now spent two hours and could not get it to work. I tried cloning the example project and creating one from scratch. I always run into the following error:
~/example-project
❯ sls invoke local -f hello
Serverless: Package version mismatch: NPM: 0.7.5, Stack: 0.6.7. Versions must be in sync to work correctly. Please install matching versions of NPM and Stack packages by either pinning your NPM version to match stack, or adding an extra-dep in your stack.yaml to match the NPM version.
Error --------------------------------------------------
Package version mismatch.
For debugging logs, run again after setting the "SLS_DEBUG=*" environment variable.
Get Support --------------------------------------------
Docs: docs.serverless.com
Bugs: github.com/serverless/serverless/issues
Issues: forum.serverless.com
Your Environment Information -----------------------------
OS: linux
Node Version: 8.12.0
Serverless Version: 1.32.0
Note: I am fairly new to haskell development.
I tried
- adding
extra-dep
to stack.yaml
but the npm package was not found in the registry. Downgrading to an old version of NPM was not straightforward plus I do not get why the version of NPM would be relevant. Is the message maybe referring to NodeJS rather than NPM?
- Why do I need a realy old version of stack for this to work?
It would be nice if the example project would be working with the latest or modern versions of stack and node.
- I could not find documentation on the error message.
- I have no clue what to sync with what as I could not find configuration pointing to the versions mentioned in the error message.
After adding ld-options: -static -pthread
to my .cabal, sls deploy
fails in the stack build step with no error message. During the build, stack issues a bunch of warnings like Using 'getprotobyname' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking"
, but no actual error messages. Yet for whatever reason the process returns status code 1.
Odder still, when I change the fail condition in the runStack function from result.status > 0
to result.status > 1
, the executable gets deployed and runs successfully.
Considering that static linking is often necessary for deployment to serverless, there should be some better handling for this case, and we should also look upstream to figure out why stack is returning an error code.
There's a fairly standard set of types for these defined https://hackage.haskell.org/package/http-types. wai
(Web Application Interface) depends on them directly. Beyond the general benefits of standardization, using the standards here would make it slightly easier to package up WAI
applications for use with API Gateway.
Here's a rough draft of that:
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE TypeApplications #-}
module Main where
import AWSLambda.Events.APIGateway as AWS hiding (requestBody)
import qualified AWSLambda.Events.APIGateway as AWS
import Control.Lens
import Control.Monad ((<=<))
import qualified Data.Aeson.TextValue as Aeson
import Data.ByteString (ByteString)
import Data.ByteString.Builder (toLazyByteString)
import qualified Data.ByteString.Lazy as Lazy
import qualified Data.CaseInsensitive as CI
import Data.Convertible (Convertible, convert)
import qualified Data.HashMap.Strict as HashMap
import Data.IORef (IORef, modifyIORef', newIORef,
readIORef, writeIORef)
import Data.Maybe
import Data.Semigroup ((<>))
import Data.Text (Text, splitOn)
import Network.HTTP.Types as HTTP
import qualified Network.Wai as Wai
import Network.Wai.Handler.Warp (runEnv)
import qualified Network.Wai.Internal as Wai
import System.Environment (lookupEnv)
echo :: Wai.Application
echo req sendResponse =
sendResponse . Wai.responseLBS HTTP.ok200 mempty =<< Wai.strictRequestBody req
main :: IO ()
main = do
useWarp <- lookupEnv "WARP"
case useWarp of
Just _ -> runEnv 8000 echo
Nothing -> apiGatewayMain . wrapper @Text @Text $ echo
wrapper ::
(Eq t, Monoid t, Convertible Lazy.ByteString t, Convertible s ByteString)
=> Wai.Application
-> APIGatewayProxyRequest s
-> IO (APIGatewayProxyResponse t)
wrapper app req =
fromWaiResponse . fromJust <=< withIORef Nothing $ \responseRef -> do
first <- newIORef True
app
(toWaiRequest first req)
(fmap (const Wai.ResponseReceived) . writeIORef responseRef . Just)
toWaiRequest ::
(Convertible t ByteString)
=> IORef Bool
-> APIGatewayProxyRequest t
-> Wai.Request
toWaiRequest first req = Wai.Request {..}
where
requestMethod = req ^. agprqHttpMethod . to convert
httpVersion = error "No HTTP version"
rawPathInfo = req ^. agprqPath . to convert
rawQueryString = error "No raw query string"
requestHeaders =
req ^.. agprqHeaders . to itoList . traverse .
to (bimap (CI.mk . convert) convert)
isSecure = error "Not HTTP or HTTPS"
remoteHost = error "No remote host"
pathInfo = req ^. agprqPath . to (splitOn "/")
queryString =
req ^.. agprqQueryStringParameters . to itoList . traverse .
to (bimap convert (Just . convert))
requestBody' = req ^? AWS.requestBody . _Just . to convert
requestBody = yieldOnce (fromMaybe mempty requestBody') first
vault = mempty
requestBodyLength = Wai.KnownLength . convert . length $ requestBody'
requestHeaderHost = req ^? agprqHeaders . ix "Host" . to convert
requestHeaderRange = req ^? agprqHeaders . ix "Range" . to convert
requestHeaderReferer = req ^? agprqHeaders . ix "Referer" . to convert
requestHeaderUserAgent = req ^? agprqHeaders . ix "User-Agent" . to convert
yieldOnce :: Monoid b => b -> IORef Bool -> IO b
yieldOnce payload ref = do
first <- readIORef ref
if first
then payload <$ writeIORef ref False
else mempty
withIORef :: b -> (IORef b -> IO a) -> IO b
withIORef a m = do
ref <- newIORef a
_ <- m ref
readIORef ref
fromWaiResponse ::
(Convertible Lazy.ByteString t, Eq t, Monoid t)
=> Wai.Response
-> IO (APIGatewayProxyResponse t)
fromWaiResponse res = do
_agprsBody <-
waiBody $ \f ->
fmap mungeBody . withIORef mempty $ \contentRef ->
f (\chunk -> modifyIORef' contentRef (<> chunk)) mempty
pure $ APIGatewayProxyResponse {..}
where
mungeBody = nonEmpty . convert . toLazyByteString
nonEmpty x
| x == mempty = Nothing
| otherwise = Just (Aeson.TextValue x)
(HTTP.Status _agprsStatusCode _, waiHeaders, waiBody) =
Wai.responseToStream res
_agprsHeaders =
HashMap.fromList . fmap (bimap (convert . CI.original) (convert . id)) $
waiHeaders
As you can see, toWaiRequest
and fromWaiResponse
would benefit a bit from better harmony with the standard.
Thanks for the great library. I am looking a way to run serverless-haskell in Google Functions instead of AWS Lambda.
Aws Lambda with custom runtime support makes it pretty easy to create runtimes aside with officially supported languages. Google Functions doen't have custom runtimes support and I am trying to figure out if running haskell is even possible.
Do you have any idea on how to achieve this?
I followed the instructions,
stack new mypackage https://raw.githubusercontent.com/seek-oss/serverless-haskell/master/serverless-haskell.hsfiles
cd mypackage
npm install
stack build
sls invoke local -f mypackage-func
and got this,
Cannot read property 'schema' of undefined
Here is the SLS debug info,
sls invoke local -f mypackage-func
Serverless: Load command config
Serverless: Load command config:credentials
Serverless: Load command create
Serverless: Load command install
Serverless: Load command package
Serverless: Load command deploy
Serverless: Load command deploy:function
Serverless: Load command deploy:list
Serverless: Load command deploy:list:functions
Serverless: Load command invoke
Serverless: Load command invoke:local
Serverless: Load command info
Serverless: Load command logs
Serverless: Load command metrics
Serverless: Load command print
Serverless: Load command remove
Serverless: Load command rollback
Serverless: Load command rollback:function
Serverless: Load command slstats
Serverless: Load command plugin
Serverless: Load command plugin
Serverless: Load command plugin:install
Serverless: Load command plugin
Serverless: Load command plugin:uninstall
Serverless: Load command plugin
Serverless: Load command plugin:list
Serverless: Load command plugin
Serverless: Load command plugin:search
Serverless: Load command config
Serverless: Load command config:credentials
Serverless: Load command rollback
Serverless: Load command rollback:function
Type Error ---------------------------------------------
Cannot read property 'schema' of undefined
For debugging logs, run again after setting the "SLS_DEBUG=*" environment variable.
Stack Trace --------------------------------------------
TypeError: Cannot read property 'schema' of undefined
at new ServerlessPlugin (/Users/vifo/git/mypackage/node_modules/serverless-haskell/dist/index.js:115:35)
at PluginManager.addPlugin (/usr/local/lib/node_modules/serverless/lib/classes/PluginManager.js:62:28)
at /usr/local/lib/node_modules/serverless/lib/classes/PluginManager.js:102:14
at Array.forEach (<anonymous>)
at PluginManager.loadPlugins (/usr/local/lib/node_modules/serverless/lib/classes/PluginManager.js:98:13)
at PluginManager.loadServicePlugins (/usr/local/lib/node_modules/serverless/lib/classes/PluginManager.js:151:10)
at PluginManager.loadAllPlugins (/usr/local/lib/node_modules/serverless/lib/classes/PluginManager.js:94:10)
at /usr/local/lib/node_modules/serverless/lib/Serverless.js:72:26
From previous event:
at Serverless.init (/usr/local/lib/node_modules/serverless/lib/Serverless.js:70:8)
at /usr/local/lib/node_modules/serverless/bin/serverless:42:21
at processImmediate (internal/timers.js:461:21)
From previous event:
at /usr/local/lib/node_modules/serverless/bin/serverless:28:46
at Object.<anonymous> (/usr/local/lib/node_modules/serverless/bin/serverless:65:4)
at Module._compile (internal/modules/cjs/loader.js:1076:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1097:10)
at Module.load (internal/modules/cjs/loader.js:941:32)
at Function.Module._load (internal/modules/cjs/loader.js:782:14)
at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:72:12)
at internal/main/run_main_module.js:17:47
Get Support --------------------------------------------
Docs: docs.serverless.com
Bugs: github.com/serverless/serverless/issues
Issues: forum.serverless.com
Your Environment Information ---------------------------
OS: darwin
Node Version: 14.12.0
Serverless Version: 1.43.0
I am opening this issue with the hopes of resolving this issue or updating the readme docs with steps to avert this issue for future users.
/var/stackage/work/unpack-dir/unpacked/serverless-haskell-0.12.6-0aad6e7c1ea6e0a0f623b102101ff644049eb980a3c9c13889c31f73e8fc53cd/src/AWSLambda/Events/KinesisEvent.hs:18:1: error:
Could not find module ‘Network.AWS.Data.Base64’
Use -v (or `:set -v` in ghci) to see a list of the files searched for.
|
18 | import Network.AWS.Data.Base64 (Base64 (..))
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
/var/stackage/work/unpack-dir/unpacked/serverless-haskell-0.12.6-0aad6e7c1ea6e0a0f623b102101ff644049eb980a3c9c13889c31f73e8fc53cd/src/AWSLambda/Events/KinesisEvent.hs:19:1: error:
Could not find module ‘Network.AWS.Kinesis.Types’
Use -v (or `:set -v` in ghci) to see a list of the files searched for.
|
19 | import qualified Network.AWS.Kinesis.Types as Kinesis
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
/var/stackage/work/unpack-dir/unpacked/serverless-haskell-0.12.6-0aad6e7c1ea6e0a0f623b102101ff644049eb980a3c9c13889c31f73e8fc53cd/src/AWSLambda/Events/KinesisEvent.hs:20:1: error:
Could not find module ‘Network.AWS.Types’
Perhaps you meant
Network.DNS.Types (needs flag -package-id dns-4.2.0)
Network.TLS.Types
Network.S3.Types
Use -v (or `:set -v` in ghci) to see a list of the files searched for.
|
20 | import qualified Network.AWS.Types as AWS
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Disabled serverless-haskell
in nightly build for now.
It would be good to document whether this project is restricted to aws lambda or if all serverless cloud providers are supported (and which ones are tested).
Only the same versions of the serverless plugin and the Haskell package are guaranteed to work. Updating the one means updating the other. Need to:
- Document this
- In serverless plugin, check the Haskell package version (
stack list-dependencies --depth 1 | grep serverless-haskell
)
The readme is good, but it doesn't explain what happens during deploy
. Which ghc version is being used? Is ghci used? Which build systems are used? Cabal or stack?
I'm trying to deploy the example project, but it fails given that Ubuntu 18.04 is shipped with glibc
2.27, so when invoking the lambda it complains that it cannot find it.
Any ideas on how to fix this? Is there a docker image available for building this properly?
serverless.yml
provider:
runtime: haskell
...
plugins:
- serverless-domain-manager
- serverless-haskell
- serverless-offline
...
package.json
{
"devDependencies": {
"serverless": "1.48.1",
"serverless-domain-manager": "2.6.6",
"serverless-haskell": "0.9.1",
"serverless-offline": "5.12.0"
}
}
stack.yml
resolver: lts-14.1
extra-deps:
- morpheus-graphql-0.4.0
- aeson-1.4.4.0
- time-compat-1.9.2.2
- serverless-haskell-0.9.1
- amazonka-kinesis-1.6.1
- amazonka-core-1.6.1
- amazonka-s3-1.6.1
package.yml
dependencies:
- base >= 4.7 && < 5
- serverless-haskell >= 0.9.1
- aeson
- lens
- bytestring
- containers >= 0.4.2.1 && < 0.7
- split
- text
- morpheus-graphql >= 0.4.0
...
with this configuration i try to run sls offline start
but it trows error:
Type Error ---------------------------------------------
TypeError: Cannot read property 'serverless-haskell' of undefined
at ServerlessPlugin.assertServerlessPackageVersionsMatch (./mythology-api/node_modules/serverless-haskell/index.js:180:34)
at deployedFunctions.forEach.funcName (./mythology-api/node_modules/serverless-haskell/index.js:287:18)
at Array.forEach (<anonymous>)
at ServerlessPlugin.buildHandlers (./mythology-api/node_modules/serverless-haskell/index.js:266:34)
at ServerlessPlugin.buildHandlersLocal (./mythology-api/node_modules/serverless-haskell/index.js:222:14)
Sorry for raising another issue, but I can't really explain what is going on.
I have used the stack template to create a new project and updated the resolver to lts-13.19
.
I can run the function locally without any issues and deploying it worked also fine.
Unfortunately, running the deployed function times out.
{
"errorMessage": "2019-05-04T15:54:49.122Z 39a8c872-a36b-47d7-b84c-9d4e694b2029 Task timed out after 6.01 seconds"
}
Error --------------------------------------------------
Invoked function failed
Your Environment Information ---------------------------
OS: linux
Node Version: 11.14.0
Serverless Version: 1.41.1
I have played around with the deployed javascript file and it seems like waiting for the server is the culprit.
const socket = await connection;
I have put return { statusCode: 200, body: JSON.stringify('Hello from Lambda!')};
before this line and the lambda finishes fine. If I put it after awaiting the connection it times out.
Not sure if anyone can reproduce this or knows what I am doing wrong?
This is just an idea / feature request.
I have been playing around with serverless-haskell for a few days now and it works quite well.
The only issue I can see is using it with continuous deployment.
I use Gitlab CI and I would love to be able to split building and deploying into 2 build steps.
This would require being able to invoke serverless deploy
without building, but using an already built binary.
So basically I would love to be able to
- Build without docker
- Deploy binary built in step 1
Of course there might be a better way of doing this, it was just an idea I've had.
I am also willing to help building this if you think it is a good idea.
I belief you intend to Port this to Google, but they released cloud run which is serverless on containers. Between that and anthos, will delivering Google offering become priority.
Im not in love with aws, because of the above, aws doesnt deserve it :p.
serverless-haskell should add all dependencies of a handler by default, and should allow the user to ignore dependencies if needed. This would make configuration easier.
I have made a fix which does this. I can make a pull request for this if desired. The ignoreLibraries
are added to the IGNORE_LIBRARIES
list.
Recommend Projects
-
-
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
An Open Source Machine Learning Framework for Everyone
-
The Web framework for perfectionists with deadlines.
-
A PHP framework for web artisans
-
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
Some thing interesting about web. New door for the world.
-
A server is a program made to process requests and deliver data to clients.
-
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Some thing interesting about visualization, use data art
-
Some thing interesting about game, make everyone happy.
-
Recommend Org
-
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Open source projects and samples from Microsoft.
-
Google ❤️ Open Source for everyone.
-
Alibaba Open Source for everyone
-
Data-Driven Documents codes.
-
China tencent open source team.
-