How do I install swagger in a Sails.js 1.x no-frontend project? - node.js

I recently started a new sail.js 1.2.3 project for building apis. I installed the project with the --no-frontend option specified.
I have the following npm packages installed:
"sails-hook-orm": "^2.1.1",
"sails-hook-sockets": "^2.0.0",
"sails-hook-swagger-generator": "^2.8.2",
"sails-postgresql": "^1.0.2",
"sails-swagger": "^0.5.1",
"sails-util-micro-apps": "^1.1.1",
"swagger-ui-dist": "^3.23.11",
I created a swagger folder in my project, and when I run sails lift , the swagger.json file gets rebuilt (I think correctly).
However, I cannot get swagger-ui configured to use the swagger.json file, and I can't get the sails.js project to display the swagger-ui docs.
Here's what I already tried:
Swagger Sails JS
Here's the results from running sails lift:
debug: hookPath: C:\Users\...\node_modules\sails-swagger\dist\api\hooks\swagger
debug: marlinspike (swagger): loading config from C:\Users\...\node_modules\sails-swagger\dist\config
debug: In route `/swagger/doc`:
debug: The `cors.origin` config has been deprecated.
debug: Please use `cors.allowOrigins` instead.
debug: (See http://sailsjs.com/config/security for more info.)
debug: In route `/swagger/doc`:
debug: The `cors.methods` config has been deprecated.
debug: Please use `cors.allowRequestMethods` instead.
debug: In route `/swagger/doc`:
debug: When specifying multiple allowable CORS origins, the allowOrigins setting
debug: should be an array of strings. We'll split it up for you this time...
debug: marlinspike (swagger): loading Services from C:\Users\...\node_modules\sails-swagger\dist\api\services...
warn: marlinspike (swagger): no Services found. skipping
debug: marlinspike (swagger): loading Models...
debug: marlinspike (swagger): loading Controllers...
debug: marlinspike (swagger): loading Policies...
warn: marlinspike (swagger): no Policies found. skipping
No tag for this identity 'status'
No tag for this identity ''
No tag for this identity ''
No tag for this identity ''
No tag for this identity ''
No tag for this identity ''
No tag for this identity ''
No tag for this identity ''
No tag for this identity ''
No tag for this identity ''
No tag for this identity ''
No tag for this identity ''
No tag for this identity ''
No tag for this identity ''
No tag for this identity ''
No tag for this identity ''
No tag for this identity 'swagger'
No tag for this identity 'swagger'
No tag for this identity 'swagger'
No tag for this identity 'swagger'
No tag for this identity 'swagger'
No tag for this identity 'swagger'
info: ·• Auto-migrating... (drop)
Swagger generated successfully
info: ✓ Auto-migration complete.
warn: Ignored attempt to bind route (/swagger/doc) to unknown action :: { cors:
{ allowOrigins: [ 'http://swagger.balderdash.io' ],
allowRequestMethods: 'GET,OPTIONS,HEAD',
allRoutes: true,
allowCredentials: true,
allowRequestHeaders: 'content-type',
allowResponseHeaders: '',
allowAnyOriginWithCredentialsUnsafe: false },
controller: 'SwaggerController',
action: 'doc' }
info:
info: .-..-.
info:
info: Sails <| .-..-.
info: v1.2.3 |\
info: /|.\
info: / || \
info: ,' |' \
info: .-'.-==|/_--'
info: `--'-------'
info: __---___--___---___--___---___--___
info: ____---___--___---___--___---___--___-__
info:
info: Server lifted in `C:\Users\...`
info: To shut down Sails, press <CTRL> + C at any time.
info: Read more at https://sailsjs.com/support.
I want to run sails lift, have the swagger.json file updated, then have a route/path I can use to see the expected swagger ui.
Thanks in advance!```

Related

Eclipse Che 7 Node.js Error: This workspace is using old definition format

I am new to using Eclipse Che. After trying (and failing, see error at the end) to install it on a local kubernetes cluster according to this article, I ended up running it locally using docker according to documentation on: https://www.eclipse.org/che/docs/che-6/docker-single-user.html. Even thought this is the documentation for version 6 it seems to start version 7 just fine.
It starts up normally (warnings don't matter AFAIK):
WARN: Bound 'eclipse/che' to 'eclipse/che:7.0.0-beta-5.0'
INFO: Proxy: HTTP_PROXY=gateway.docker.internal:3128, HTTPS_PROXY=gateway.docker.internal:3129, NO_PROXY=
WARN: Potential networking issue discovered!
WARN: We have identified that http and https proxies are set but no_proxy is not. This may cause fatal networking errors. Set no_proxy for your Docker daemon!
INFO: (che cli): 7.0.0-beta-5.0 - using docker 18.06.1-ce / docker4mac
WARN: Newer version 'rc' available
INFO: (che init): Installing configuration and bootstrap variables:
INFO: (che init): CHE_HOST=192.168.65.3
INFO: (che init): CHE_VERSION=7.0.0-beta-5.0
INFO: (che init): CHE_CONFIG=~/che
INFO: (che init): CHE_INSTANCE=~/che/instance
INFO: (che config): Generating che configuration...
INFO: (che config): Customizing docker-compose for running in a container
INFO: (che start): Preflight checks
mem (1.5 GiB): [OK]
disk (100 MB): [OK]
port 8080 (http): [AVAILABLE]
conn (browser => ws): [OK]
conn (server => ws): [OK]
INFO: (che start): Starting containers...
INFO: (che start): Services booting...
INFO: (che start): Server logs at "docker logs -f che"
INFO: (che start): Booted and reachable
INFO: (che start): Ver: 7.0.0-beta-5.0
INFO: (che start): Use: http://localhost:8080
INFO: (che start): API: http://localhost:8080/swagger
I get the workspace set up screen and select the node.js stack. The stack is created just fine and the workspace is running. However, then, I am stuck. Cannot create any new project or import project. If I go to the workspace configuration, the top bar shows the following error:
The IDE shows "There are no projects", even though they are shown when listing projects from the workspace overview:
I tried looking in the documentation, but since the link points to the docs for version 6, it does not mention anything about updating the workspace definition. I also tried deleting and re-creating the workspace and I tried creating a project from a template (nodejs-hello-world and web-nodejs-simple).
Is there anyone who has the same problem or has already solved it? There should be a way to use old workspace definitions. I guess my next step is to downgrade to version 6 or to follow the installation steps for version 7, which is using chectl.
PS: for completeness sake, here is the error I ran into when following the manual on installing eclipse che 6 using docker for Mac:
helm upgrade --install che --namespace che --set cheImage=eclipse/che-server:6.19.5 --set global.cheWorkspacesNamespace="che" --set
global.ingressDomain=${CHE_DOMAIN}.nip.io ./
Release "che" does not exist. Installing it now.
Error: validation failed: error validating "": error validating data:
[unknown object type "nil" in ConfigMap.data.CHE_LOGGER_CONFIG, unknown
object type "nil" in ConfigMap.data.CHE_OAUTH_GITHUB_CLIENTID, unknown object
type "nil" in ConfigMap.data.CHE_OAUTH_GITHUB_CLIENTSECRET, unknown object
type "nil" in ConfigMap.data.CHE_WORKSPACE_HTTPS__PROXY, unknown object type
"nil" in ConfigMap.data.CHE_WORKSPACE_HTTP__PROXY, unknown object type "nil"
in ConfigMap.data.CHE_WORKSPACE_NO__PROXY]
UPDATE 1: Added screenshots of projects and project view. Also tried downgrading to 6.19.0, with same result. Of course I also checked the documentation for Che 7, but it also does not mention updating workspace definitions.
UPDATE 2: Using chectl according to the quick-starts guide did not help, since I ran into an issue when starting up the pods. I reported the issue to the chectl team and hope to be able to help them resolve it.

What does "Failed to parse video codecs correctly." mean?

I deploy this Agora.io Webrtc sample on launching Express + node.js webserver on chrome browser in accordance with WebRTC documents.
This appears to be Chrome
(index):78 Init AgoraRTC client with vendor key: ***
AgoraRTCSDK-1.8.0.js:842 INFO: Client in Live mode
(index):83 AgoraRTC client initialized
AgoraRTCSDK-1.8.0.js:842 INFO: VOSGateway connected.
(index):85 User 2502359564 join channel successfully
AgoraRTCSDK-1.8.0.js:842 DEBUG: Requested access to local media
AgoraRTCSDK-1.8.0.js:842 DEBUG: Object {video: Object, audio: true, fake: undefined}
adapter.js:32 chrome: {"video":{"mandatory":{"minWidth":1280,"minHeight":720,"maxWidth":1280,"maxHeight":720,"maxFrameRate":25,"minFrameRate":25},"optional":[]},"audio":true}
AgoraRTCSDK-1.8.0.js:842 INFO: User has granted access to local media.
(index):94 getUserMedia successfully
AgoraRTCSDK-1.8.0.js:842 DEBUG: Safari
AgoraRTCSDK-1.8.0.js:842 DEBUG: Set Video Bitrate - min:30 max:1500
adapter.js:340 Uncaught (in promise) DOMException: Failed to parse SessionDescription. Failed to parse video codecs correctly.
(anonymous) # adapter.js:340
(anonymous) # adapter.js:332
webkitRTCPeerConnection.(anonymous function) # adapter.js:331
(anonymous) # AgoraRTCSDK-1.8.0.js:457
AgoraRTCSDK-1.8.0.js:842 INFO: video dimensions: 1280 720
I got failed result and tried to re-install some google chrome versions contained v54, v56, v57, v59 and latest one. But every chrome version have same error that
adapter.js:340 Uncaught (in promise) DOMException: Failed to parse SessionDescription. Failed to parse video codecs correctly.
What does mean it?
The "Failed to parse video codecs correctly" error is a known sdp compatibility issue caused by setMaxBW interface. The 1.8.0 version isn't recommended as it is outdated. I'd recommend upgrade to the latest version.

Error 400 on puppet SERVER

On agent node:
root#agent2-VirtualBox:/var/lib/puppet# puppet agent -t
Info: Retrieving pluginfacts
Info: Retrieving plugin
Info: Loading facts
Error: Could not retrieve catalog from remote server: Error 400 on SERVER: Could not find default node or by name with 'agent2-virtualbox.servicemesh.com, agent2-virtualbox.servicemesh, agent2-virtualbox, agent2-VirtualBox.servicemesh.com, agent2-VirtualBox.servicemesh, agent2-VirtualBox' on node agent2-virtualbox.servicemesh.com
Warning: Not using cache on failed catalog
Error: Could not retrieve catalog; skipping run
root#agent2-VirtualBox:/var/lib/puppet#
On the puppet master side:
root#puppetmaster:~# puppet cert sign --all
Error: No waiting certificate requests to sign
root#puppetmaster:~#
How to resolve this?
You need to check you site.pp and make sure you either have a default node definition defined or a node definition for the FQDN of your agent.
https://docs.puppet.com/puppet/latest/reference/lang_node_definitions.html
for example:
node 'agent2-virtualbox.servicemesh.com' {
import ntp
}

puppet: Not authorized to call find

I'm running puppet 2.7.26 because that's what the redhat package provides.
I'm trying to serve files that are NOT stored within any puppet modules. The files are maintained in another location on the puppet server, and that is where I need to serve them from.
I have this in my /etc/puppet/fileserver.conf
[files]
path /var/www/cobbler/pub
allow *
And then I have a class file like this:
class etchostfile
(
$hostfile /* declare that this class has one parameter */
)
{
File
{
owner => 'root',
group => 'root',
mode => '0644',
}
file { $hostfile :
ensure => file,
source => "puppet:///files/hosts-${hostfile}.txt",
path => '/root/hosts',
}
}
But when my node calls
class { 'etchostfile' :
hostfile => foo,
}
I get this error
err: /Stage[main]/Etchostfile/File[foo]: Could not evaluate: Error 400
on SERVER: Not authorized to call find on
/file_metadata/files/hosts-foo.txt with {:links=>"manage"} Could not
retrieve file metadata for puppet:///files/hosts-foo.txt: Error 400 on
SERVER: Not authorized to call find on
/file_metadata/files/hosts-foo.txt with {:links=>"manage"} at
/etc/puppet/modules/etchostfile/manifests/init.pp:27
This post
https://viewsby.wordpress.com/2013/04/05/puppet-error-400-on-server-not-authorized-to-call-find/
indicates that this is all I need to do. But I must be missing something.
UPDATE
When I run the master in debug mode, I get no error.
The master responds thusly:
info: access[^/catalog/([^/]+)$]: allowing 'method' find
info: access[^/catalog/([^/]+)$]: allowing $1 access
info: access[^/node/([^/]+)$]: allowing 'method' find
info: access[^/node/([^/]+)$]: allowing $1 access
info: access[/certificate_revocation_list/ca]: allowing 'method' find
info: access[/certificate_revocation_list/ca]: allowing * access
info: access[^/report/([^/]+)$]: allowing 'method' save
info: access[^/report/([^/]+)$]: allowing $1 access
info: access[/file]: allowing * access
info: access[/certificate/ca]: adding authentication any
info: access[/certificate/ca]: allowing 'method' find
info: access[/certificate/ca]: allowing * access
info: access[/certificate/]: adding authentication any
info: access[/certificate/]: allowing 'method' find
info: access[/certificate/]: allowing * access
info: access[/certificate_request]: adding authentication any
info: access[/certificate_request]: allowing 'method' find
info: access[/certificate_request]: allowing 'method' save
info: access[/certificate_request]: allowing * access
info: access[/]: adding authentication any
info: Inserting default '/status' (auth true) ACL because none were found in '/etc/puppet/auth.conf'
info: Expiring the node cache of agent.redacted.com
info: Not using expired node for agent.redacted.com from cache; expired at Thu Aug 13 14:18:48 +0000 2015
info: Caching node for agent.redacted.com
debug: importing '/etc/puppet/modules/etchostfile/manifests/init.pp' in environment production
debug: Automatically imported etchostfile from etchostfile into production
debug: File[foo]: Adding default for selrange
debug: File[foo]: Adding default for group
debug: File[foo]: Adding default for seluser
debug: File[foo]: Adding default for selrole
debug: File[foo]: Adding default for owner
debug: File[foo]: Adding default for mode
debug: File[foo]: Adding default for seltype
notice: Compiled catalog for agent.redacted.com in environment production in 0.11 seconds
info: mount[files]: allowing * access
debug: Received report to process from agent.redacted.com
debug: Processing report from agent.redacted.com with processor Puppet::Reports::Store
and the agent responds thusly:
info: Caching catalog for agent.redacted.com
info: Applying configuration version '1439475588'
notice: /Stage[main]/Etchostfile/File[foo]/ensure: defined content as '{md5}75125a96a68a0ff0d42f91f10dca8336'
notice: Finished catalog run in 0.42 seconds
and the file is properly installed/updated.
So it works when the master is in debug mode, but it errors when the master is in standard (?) mode. I can go back and forth, in and out of debug mode at will, and it works every time in debug mode, and it fails every time in standard mode.
UPDATE 2
Running puppetmasterd from the command line, and everything works.
Running service puppetmaster start or /etc/init.d/puppetmaster start from the command line, and it fails. So at least I'm getting closer.
/etc/sysconfig/puppetmaster is entirely commented out. So as of now, I do not see any difference between just starting puppetmasterd and using the service script.
UPDATE 3
I think it's an SELinux problem.
With SELinux "enforcing" on the master, service puppetmaster restart, and I get the error.
I change SELinux to "Permissive" on the master, and I still get the error.
But now that SELinux is set to Permissive, if I service puppetmaster restart, my files get served properly.
But now that it's working, I set SELinux to Enforcing, and I get a different error:
err: /Stage[main]/Etchostfile/File[foo]: Could not evaluate: Could not
retrieve information from environment production source(s)
puppet:///files/hosts-foo.txt at
/etc/puppet/modules/etchostfile/manifests/init.pp:27
Then I do a service puppetmaster restart and I'm back to the original error.
So the situation changes depending on
how I started the service (puppetmasterd or service)
what SELinux was set to when I started the service
what SELinux is set to when the agent runs.
The closer I get, the more confused I get.
UPDATE 4
I think I found it. Once I started looking at SELinux, I found the policy changes I needed to make (allowing ruby/puppet to access cobbler files) and now it appears to be working...
This turned out to be an SELinux problem. I eventually found this error message
SELinux is preventing /usr/bin/ruby from read access
on the file /var/www/cobbler/pub/hosts-foo.txt .
which led me to the audit2allow rules I needed to apply to allow puppet to access my cobbler files.
I was getting this error with puppet server on ubuntu 20.
Error: /Stage[main]/Dvod_tocr/File[/install/wine-data.tar.gz]: Could not evaluate: Could not retrieve file metadata for puppet:///extra_files/wine-data.tar.gz: Error 500 on SERVER: Server Error: Not authorized to call find on /file_metadata/extra_files/wine-data.tar.gz with {:rest=>"extra_files/wine-data.tar.gz", :links=>"manage", :checksum_type=>"sha256", :source_permissions=>"ignore"}
My fileserver.conf file was in the wrong location. The correct location for this puppet version and on ubuntu 20 is /etc/puppetlabs/puppet/fileserver.conf

Ember:SimpleAuth is undefined using ember-simple-auth

I am a newbie to JaveScript and HTML.
Looking at an existing code and struggling with below from quite some time now.
Below is the console output.
Getting the Uncaught error at below line in my code.
App.CustomAuthenticator = Ember.SimpleAuth.Authenticators.Base.extend({
The Ember.SimpleAuth is showing as undefined.
DEBUG: ------------------------------- ember.js:3461
DEBUG: Ember : 1.4.0 ember.js:3461
DEBUG: Ember Data : 1.0.0-beta.7+canary.b45e23ba ember.js:3461
DEBUG: Handlebars : 1.1.2 ember.js:3461
DEBUG: jQuery : 1.9.1 ember.js:3461
DEBUG: Ember Simple Auth : 0.6.4 ember.js:3461
DEBUG: ------------------------------- ember.js:3461
Uncaught TypeError: Cannot read property 'Authenticators' of undefined
Appreciate the help
Ember Simple Auth now defines its own global SimpleAuth and doesn't attach to the Ember global anymore so you need to change your code to:
App.CustomAuthenticator = SimpleAuth.Authenticators.Base.extend({
…
})

Resources