Support for Devise?

Does Jets support Devise?
I installed Devise gem like a normal Rails app however, when spinning up the local server i get a error in my routes.rb file

undefined method `devise_for’ for #Jets::Router:0x00007ff6614510c8

1 Like

Currently, not supported. Happy to consider PRs :smile:

1 Like

As workaround I created a simple rails app with devise and imported it with jets import:rails , it’s working well for me.

1 Like

Glad, it worked out. This post may interest you Rails on Jets vs. "Plain Jets" also

i tried out that workaround. Works perfectly locally, but i get an error when i deploy it to AWS.

From Cloudwatch:
RubyError: Errno::EAFNOSUPPORT: Failed to open TCP connection to localhost:9292 (Address family not supported by protocol - socket(2) for “localhost” port 9292)

Weird the Errno::EAFNOSUPPORT was been fixed by https://github.com/tongueroo/jets/pull/247 Wondering if you are running the latest version of Jets?

I checked the jets version and it returned ‘1.9.1’
I ran ‘jets upgrade’ then ‘jets deploy’

I am still getting the same error in Cloudwatch

START RequestId: 31995e94-2e7e-4f74-ba96-f3bbffa5c9d0 Version: $LATEST
=> unzip -qo /tmp/rack-9ccf4b34.zip -d /tmp/rack
=> cd /var/task/rack && bin/rackup --host 127.0.0.1
/var/runtime/gems/bundler-2.0.1/lib/bundler/spec_set.rb:87:in block in materialize': Could not find sassc-2.0.1 in any of the sources (Bundler::GemNotFound) from /var/runtime/gems/bundler-2.0.1/lib/bundler/spec_set.rb:81:inmap!’
from /var/runtime/gems/bundler-2.0.1/lib/bundler/spec_set.rb:81:in materialize' from /var/runtime/gems/bundler-2.0.1/lib/bundler/definition.rb:170:inspecs’
from /var/runtime/gems/bundler-2.0.1/lib/bundler/definition.rb:237:in specs_for' from /var/runtime/gems/bundler-2.0.1/lib/bundler/definition.rb:226:inrequested_specs’
from /var/runtime/gems/bundler-2.0.1/lib/bundler/runtime.rb:108:in block in definition_method' from /var/runtime/gems/bundler-2.0.1/lib/bundler/runtime.rb:20:insetup’
from /var/runtime/gems/bundler-2.0.1/lib/bundler.rb:107:in setup' from /var/runtime/gems/bundler-2.0.1/lib/bundler/setup.rb:20:in<top (required)>’
from /var/lang/lib/ruby/site_ruby/2.5.0/rubygems/core_ext/kernel_require.rb:54:in require' from /var/lang/lib/ruby/site_ruby/2.5.0/rubygems/core_ext/kernel_require.rb:54:inrequire’
Giving up on trying to connect to localhost:9292
I, [2019-05-24T19:24:58.079033 #8] INFO – : Prewarm request
END RequestId: 31995e94-2e7e-4f74-ba96-f3bbffa5c9d0
REPORT RequestId: 31995e94-2e7e-4f74-ba96-f3bbffa5c9d0 Duration: 17864.60 ms Billed Duration: 17900 ms Memory Size: 1536 MB Max Memory Used: 133 MB
START RequestId: 82cea3b2-9504-4c3e-bebb-6b1384886206 Version: $LATEST
Giving up on trying to connect to localhost:9292
I, [2019-05-24T19:25:59.636209 #15] INFO – : Started GET “/users/login” for 73.51.143.226 at 2019-05-24 19:25:59 +0000
I, [2019-05-24T19:25:59.636338 #15] INFO – : Processing Jets::RackController#process
I, [2019-05-24T19:25:59.636754 #15] INFO – : Event:
{
“resource”: “/{catchall+}”,
“path”: “/users/login”,
“httpMethod”: “GET”,
“headers”: {
“Accept”: “text/html,application/xhtml+xml,application/xml;q=0.9,/;q=0.8”,
“Accept-Encoding”: “gzip, deflate, br”,
“Accept-Language”: “en-US,en;q=0.5”,
“CloudFront-Forwarded-Proto”: “https”,
“CloudFront-Is-Desktop-Viewer”: “true”,
“CloudFront-Is-Mobile-Viewer”: “false”,
“CloudFront-Is-SmartTV-Viewer”: “false”,
“CloudFront-Is-Tablet-Viewer”: “false”,
“CloudFront-Viewer-Country”: “US”,
“Host”: “tv85aafjsc.execute-api.us-east-1.amazonaws.com”,
“upgrade-insecure-requests”: “1”,
“User-Agent”: “Mozilla/5.0 (Macintosh; Intel Mac OS X 10.14; rv:66.0) Gecko/20100101 Firefox/66.0”,
“Via”: “2.0 d0e9493afe30356ba9d74f759fd26f53.cloudfront.net (CloudFront)”,
“X-Amz-Cf-Id”: “qXr62F9QGPEn8L2FMeKeSdEumacHIuDUXxphI9vBll2-ibL2SxJGbQ==”,
“X-Amzn-Trace-Id”: “Root=1-5ce84547-be66956d2c7a6ec61e06c98f”,
“X-Forwarded-For”: “73.51.143.226, 70.132.57.153”,
“X-Forwarded-Port”: “443”,
“X-Forwarded-Proto”: “https”
},
“multiValueHeaders”: {
“Accept”: [
“text/html,application/xhtml+xml,application/xml;q=0.9,/;q=0.8”
],
“Accept-Encoding”: [
“gzip, deflate, br”
],
“Accept-Language”: [
“en-US,en;q=0.5”
],
“CloudFront-Forwarded-Proto”: [
“https”
],
“CloudFront-Is-Desktop-Viewer”: [
“true”
],
“CloudFront-Is-Mobile-Viewer”: [
“false”
],
“CloudFront-Is-SmartTV-Viewer”: [
“false”
],
“CloudFront-Is-Tablet-Viewer”: [
“false”
],
“CloudFront-Viewer-Country”: [
“US”
],
“Host”: [
tv85aafjsc.execute-api.us-east-1.amazonaws.com
],
“upgrade-insecure-requests”: [
“1”
],
“User-Agent”: [
“Mozilla/5.0 (Macintosh; Intel Mac OS X 10.14; rv:66.0) Gecko/20100101 Firefox/66.0”
],
“Via”: [
“2.0 d0e9493afe30356ba9d74f759fd26f53.cloudfront.net (CloudFront)”
],
“X-Amz-Cf-Id”: [
“qXr62F9QGPEn8L2FMeKeSdEumacHIuDUXxphI9vBll2-ibL2SxJGbQ==”
],
“X-Amzn-Trace-Id”: [
“Root=1-5ce84547-be66956d2c7a6ec61e06c98f”
],
“X-Forwarded-For”: [
“73.51.143.226, 70.132.57.153”
],
“X-Forwarded-Port”: [
“443”
],
“X-Forwarded-Proto”: [
“https”
]
},
“queryStringParameters”: null,
“multiValueQueryStringParameters”: null,
“pathParameters”: {
“catchall”: “users/login”
},
“stageVariables”: null,
“requestContext”: {
“resourceId”: “a4ihp0”,
“resourcePath”: “/{catchall+}”,
“httpMethod”: “GET”,
“extendedRequestId”: “aM_DJFAoIAMFvgg=”,
“requestTime”: “24/May/2019:19:25:59 +0000”,
“path”: “/dev/users/login”,
“accountId”: “342764570912”,
“protocol”: “HTTP/1.1”,
“stage”: “dev”,
“domainPrefix”: “tv85aafjsc”,
“requestTimeEpoch”: 1558725959377,
“requestId”: “c29cddde-7e59-11e9-9299-2d2c8abfe556”,
“identity”: {
“cognitoIdentityPoolId”: null,
“accountId”: null,
“cognitoIdentityId”: null,
“caller”: null,
“sourceIp”: “73.51.143.226”,
“principalOrgId”: null,
“accessKey”: null,
“cognitoAuthenticationType”: null,
“cognitoAuthenticationProvider”: null,
“userArn”: null,
“userAgent”: “Mozilla/5.0 (Macintosh; Intel Mac OS X 10.14; rv:66.0) Gecko/20100101 Firefox/66.0”,
“user”: null
},
“domainName”: “tv85aafjsc.execute-api.us-east-1.amazonaws.com”,
“apiId”: “tv85aafjsc”
},
“body”: null,
“isBase64Encoded”: false
}

I, [2019-05-24T19:25:59.636831 #15] INFO – : Parameters:
{
“catchall”: “users/login”
}

I, [2019-05-24T19:25:59.637692 #8] INFO – : Started GET “/users/login” for 73.51.143.226 at 2019-05-24 19:25:59 +0000
I, [2019-05-24T19:25:59.637783 #8] INFO – : Processing Jets::RackController#process
I, [2019-05-24T19:25:59.638857 #8] INFO – : Event:
{
“resource”: “/{catchall+}”,
“path”: “/users/login”,
“httpMethod”: “GET”,
“headers”: {
“Accept”: “text/html,application/xhtml+xml,application/xml;q=0.9,/;q=0.8”,
“Accept-Encoding”: “gzip, deflate, br”,
“Accept-Language”: “en-US,en;q=0.5”,
“CloudFront-Forwarded-Proto”: “https”,
“CloudFront-Is-Desktop-Viewer”: “true”,
“CloudFront-Is-Mobile-Viewer”: “false”,
“CloudFront-Is-SmartTV-Viewer”: “false”,
“CloudFront-Is-Tablet-Viewer”: “false”,
“CloudFront-Viewer-Country”: “US”,
“Host”: “tv85aafjsc.execute-api.us-east-1.amazonaws.com”,
“upgrade-insecure-requests”: “1”,
“User-Agent”: “Mozilla/5.0 (Macintosh; Intel Mac OS X 10.14; rv:66.0) Gecko/20100101 Firefox/66.0”,
“Via”: “2.0 d0e9493afe30356ba9d74f759fd26f53.cloudfront.net (CloudFront)”,
“X-Amz-Cf-Id”: “qXr62F9QGPEn8L2FMeKeSdEumacHIuDUXxphI9vBll2-ibL2SxJGbQ==”,
“X-Amzn-Trace-Id”: “Root=1-5ce84547-be66956d2c7a6ec61e06c98f”,
“X-Forwarded-For”: “73.51.143.226, 70.132.57.153”,
“X-Forwarded-Port”: “443”,
“X-Forwarded-Proto”: “https”
},
“multiValueHeaders”: {
“Accept”: [
“text/html,application/xhtml+xml,application/xml;q=0.9,/;q=0.8”
],
“Accept-Encoding”: [
“gzip, deflate, br”
],
“Accept-Language”: [
“en-US,en;q=0.5”
],
“CloudFront-Forwarded-Proto”: [
“https”
],
“CloudFront-Is-Desktop-Viewer”: [
“true”
],
“CloudFront-Is-Mobile-Viewer”: [
“false”
],
“CloudFront-Is-SmartTV-Viewer”: [
“false”
],
“CloudFront-Is-Tablet-Viewer”: [
“false”
],
“CloudFront-Viewer-Country”: [
“US”
],
“Host”: [
tv85aafjsc.execute-api.us-east-1.amazonaws.com
],
“upgrade-insecure-requests”: [
“1”
],
“User-Agent”: [
“Mozilla/5.0 (Macintosh; Intel Mac OS X 10.14; rv:66.0) Gecko/20100101 Firefox/66.0”
],
“Via”: [
“2.0 d0e9493afe30356ba9d74f759fd26f53.cloudfront.net (CloudFront)”
],
“X-Amz-Cf-Id”: [
“qXr62F9QGPEn8L2FMeKeSdEumacHIuDUXxphI9vBll2-ibL2SxJGbQ==”
],
“X-Amzn-Trace-Id”: [
“Root=1-5ce84547-be66956d2c7a6ec61e06c98f”
],
“X-Forwarded-For”: [
“73.51.143.226, 70.132.57.153”
],
“X-Forwarded-Port”: [
“443”
],
“X-Forwarded-Proto”: [
“https”
]
},
“queryStringParameters”: null,
“multiValueQueryStringParameters”: null,
“pathParameters”: {
“catchall”: “users/login”
},
“stageVariables”: null,
“requestContext”: {
“resourceId”: “a4ihp0”,
“resourcePath”: “/{catchall+}”,
“httpMethod”: “GET”,
“extendedRequestId”: “aM_DJFAoIAMFvgg=”,
“requestTime”: “24/May/2019:19:25:59 +0000”,
“path”: “/dev/users/login”,
“accountId”: “342764570912”,
“protocol”: “HTTP/1.1”,
“stage”: “dev”,
“domainPrefix”: “tv85aafjsc”,
“requestTimeEpoch”: 1558725959377,
“requestId”: “c29cddde-7e59-11e9-9299-2d2c8abfe556”,
“identity”: {
“cognitoIdentityPoolId”: null,
“accountId”: null,
“cognitoIdentityId”: null,
“caller”: null,
“sourceIp”: “73.51.143.226”,
“principalOrgId”: null,
“accessKey”: null,
“cognitoAuthenticationType”: null,
“cognitoAuthenticationProvider”: null,
“userArn”: null,
“userAgent”: “Mozilla/5.0 (Macintosh; Intel Mac OS X 10.14; rv:66.0) Gecko/20100101 Firefox/66.0”,
“user”: null
},
“domainName”: “tv85aafjsc.execute-api.us-east-1.amazonaws.com”,
“apiId”: “tv85aafjsc”
},
“body”: null,
“isBase64Encoded”: false
}

I, [2019-05-24T19:25:59.638977 #8] INFO – : Parameters:
{
“catchall”: “users/login”
}

RubyError: Errno::EAFNOSUPPORT: Failed to open TCP connection to localhost:9292 (Address family not supported by protocol - socket(2) for “localhost” port 9292)
/var/lang/lib/ruby/2.5.0/net/http.rb:939:in rescue in block in connect' /var/lang/lib/ruby/2.5.0/net/http.rb:936:inblock in connect’
/var/lang/lib/ruby/2.5.0/timeout.rb:93:in block in timeout' /var/lang/lib/ruby/2.5.0/timeout.rb:103:intimeout’
/var/lang/lib/ruby/2.5.0/net/http.rb:935:in connect' /var/lang/lib/ruby/2.5.0/net/http.rb:920:indo_start’
/var/lang/lib/ruby/2.5.0/net/http.rb:909:in start' /var/lang/lib/ruby/2.5.0/net/http.rb:1458:inrequest’
/opt/ruby/gems/2.5.0/gems/jets-1.9.1/lib/jets/mega/request.rb:47:in proxy' /opt/ruby/gems/2.5.0/gems/jets-1.9.1/lib/jets/internal/app/controllers/jets/rack_controller.rb:23:inmega_request’
/opt/ruby/gems/2.5.0/gems/jets-1.9.1/lib/jets/internal/app/controllers/jets/rack_controller.rb:7:in process' /opt/ruby/gems/2.5.0/gems/jets-1.9.1/lib/jets/controller/base.rb:45:indispatch!’
/opt/ruby/gems/2.5.0/gems/jets-1.9.1/lib/jets/internal/app/controllers/jets/rack_controller.rb:16:in process!' /opt/ruby/gems/2.5.0/gems/jets-1.9.1/lib/jets/controller/base.rb:89:inprocess’
app/controllers/jets/rack_controller.rb:1:in run' /opt/ruby/gems/2.5.0/gems/jets-1.9.1/lib/jets/processors/main_processor.rb:32:ininstance_eval’
/opt/ruby/gems/2.5.0/gems/jets-1.9.1/lib/jets/processors/main_processor.rb:32:in run' /opt/ruby/gems/2.5.0/gems/jets-1.9.1/lib/jets/core.rb:125:inprocess’
/var/task/handlers/controllers/jets/rack_controller.rb:6:in process' /var/runtime/lib/lambda_handler.rb:24:incall_handler’
/var/runtime/lib/runtime.rb:42:in <main>' Error raised from handler method { "errorMessage": "Failed to open TCP connection to localhost:9292 (Address family not supported by protocol - socket(2) for \"localhost\" port 9292)", "errorType": "Function<Errno::EAFNOSUPPORT>", "stackTrace": [ "/var/lang/lib/ruby/2.5.0/net/http.rb:939:inrescue in block in connect’",
“/var/lang/lib/ruby/2.5.0/net/http.rb:936:in block in connect'", "/var/lang/lib/ruby/2.5.0/timeout.rb:93:inblock in timeout’”,
“/var/lang/lib/ruby/2.5.0/timeout.rb:103:in timeout'", "/var/lang/lib/ruby/2.5.0/net/http.rb:935:inconnect’”,
“/var/lang/lib/ruby/2.5.0/net/http.rb:920:in do_start'", "/var/lang/lib/ruby/2.5.0/net/http.rb:909:instart’”,
“/var/lang/lib/ruby/2.5.0/net/http.rb:1458:in request'", "/opt/ruby/gems/2.5.0/gems/jets-1.9.1/lib/jets/mega/request.rb:47:inproxy’”,
“/opt/ruby/gems/2.5.0/gems/jets-1.9.1/lib/jets/internal/app/controllers/jets/rack_controller.rb:23:in mega_request'", "/opt/ruby/gems/2.5.0/gems/jets-1.9.1/lib/jets/internal/app/controllers/jets/rack_controller.rb:7:inprocess’”,
“/opt/ruby/gems/2.5.0/gems/jets-1.9.1/lib/jets/controller/base.rb:45:in dispatch!'", "/opt/ruby/gems/2.5.0/gems/jets-1.9.1/lib/jets/internal/app/controllers/jets/rack_controller.rb:16:inprocess!’”,
“/opt/ruby/gems/2.5.0/gems/jets-1.9.1/lib/jets/controller/base.rb:89:in process'", "app/controllers/jets/rack_controller.rb:1:inrun’”,
“/opt/ruby/gems/2.5.0/gems/jets-1.9.1/lib/jets/processors/main_processor.rb:32:in instance_eval'", "/opt/ruby/gems/2.5.0/gems/jets-1.9.1/lib/jets/processors/main_processor.rb:32:inrun’”,
“/opt/ruby/gems/2.5.0/gems/jets-1.9.1/lib/jets/core.rb:125:in process'", "/var/task/handlers/controllers/jets/rack_controller.rb:6:inprocess’”
]
}
END RequestId: 82cea3b2-9504-4c3e-bebb-6b1384886206
REPORT RequestId: 82cea3b2-9504-4c3e-bebb-6b1384886206 Duration: 326.15 ms Billed Duration: 400 ms Memory Size: 1536 MB Max Memory Used: 164 MB

Think that’s why the rack server is not starting up. That gets closer to the issue.

Interesting. I wonder why it can’t find it. I’ll have a barebones app currently so I’ll try to remove that dependency and see if it works

I played around with it without any luck. I switch out the ‘sass-rails’ gem with ‘sassc-rails’ and got the same error.

Heres my repo that I am testing in:

path “/” returns the Jets splash screen
path “/users/login” returns a Devise login path that is defined in the imported rails app

Hi @ortizstl
Were you able to fix this issue?
I have same issue now but I can’t fix.
Could you please help me?

I managed to fix this issue by compiling and installing sassc @ 2.0.1 to a new AWS Custom Layer following the guide @ https://medium.com/@joshua.a.kahn/exploring-aws-lambda-layers-and-ruby-support-5510f81b4d14.

My input Gemfile for generating that custom layer looked as follows:

source 'https://rubygems.org'
ruby '2.5.0'

gem 'sassc', '2.0.1'

I then added this custom layer to my .jets/config/application.rb file (replacing <account_id> and <layer_name> to match my custom lambda arn uri):

  # Add additional custom sassc gem support layer
  config.lambda.layers = [
    "arn:aws:lambda:us-east-1:<account_id>:layer:<layer_name>:1"
  ]

For some reason the lambdagems service is not picking up sassc even though it requires native extensions. When jets deploy prints Checking projects gems for binary Lambda gems... we can then check that no sassc lambdagem was downloaded and therefore sassc native extensions were not bundled in to the deployed app:

$> ls -l /tmp/jets/<app_name>/lambdagems/downloads/gems/sassc-2.0.1.zip
ls: /tmp/jets/<app_name>/lambdagems/downloads/gems/sassc-2.0.1.zip: No such file or directory

There may be another easier fix but I was only able to get this working by creating my own custom lambda layer and following the steps above.

Hopefully this will point people in the right direction!

1 Like