Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • May 05 11:39
    matteofigus commented #1185
  • May 05 11:39
    matteofigus commented #1185
  • May 05 11:38

    matteofigus on v0.48.19

    (compare)

  • May 05 11:38

    matteofigus on v0.48.19

    (compare)

  • May 05 11:38

    matteofigus on master

    0.48.19 changelog (compare)

  • May 05 11:38

    matteofigus on master

    0.48.19 changelog (compare)

  • May 05 11:34

    matteofigus on master

    update oc-client-browser package Revert package json version Merge pull request #1185 from r… (compare)

  • May 05 11:34

    matteofigus on master

    update oc-client-browser package Revert package json version Merge pull request #1185 from r… (compare)

  • May 05 11:34
    matteofigus closed #1185
  • May 05 11:34
    matteofigus closed #1185
  • May 05 09:44
    pbazydlo commented #1185
  • May 05 09:44
    pbazydlo commented #1185
  • May 05 09:37
    pbazydlo commented #1185
  • May 05 09:37
    pbazydlo commented #1185
  • May 05 08:34
    ricardo-devis-agullo commented #1185
  • May 05 08:34
    ricardo-devis-agullo commented #1185
  • May 04 16:12
    matteofigus commented #1185
  • May 04 16:12
    matteofigus commented #1185
  • May 04 15:01
    ricardo-devis-agullo synchronize #1185
  • May 04 15:01
    ricardo-devis-agullo synchronize #1185
Matteo Figus
@matteofigus
Try passing as header Accept: application/vnd.oc.rendered+json
ALex
@aresobus_twitter
@matteofigus I was looking at this conversation earlier:
opencomponents/oc#324
so I'm doing almost everything in the same way, except Accept header, will add that. The problem is that I can't go pass this step with fully private bucket to get a response:
POST https://oc-registry.com -H "Accept: application/vnd.oc.info+json"
{
  components: [{
    name: 'component1',
    version: '1.X.X'
  }, {
    name: 'component2',
    version: '~1.2.4'
  }]
}
but I think it's because I don't have enough experience with AWS and I'll find what is wrong
I need a credentials because consumer is outside ;(
Artëm Tsvetkov
@adeptex
hi all :wave: im getting into OC. i setup a local registry like this: oc dev ../components 3000 and put my test component in the components dir.
now if i open a new terminal and try oc registry add http://localhost:3000 i get this error:
not a valid oc registry
but i do see the request in the registry window:
GET / 200 0.514 ms - 160
is this a bug in the code or between keyboard and chair?
1 reply
Matteo Figus
@matteofigus
Hi Artem, the add command is used for setting a publish registry instance as target. When you run the oc dev you are running a local mock therefore that cannot be a publish target and the cli detects that.
1 reply
After you setup a registry you can add that url and then publish to it
No I’m afraid there isn’t. You can check the storage adapters where you can have various options outside of aws but all of them somehow need some storage. But the riak may be something you can investigate
ALex
@aresobus_twitter
@matteofigus @kmcrawford thank you for help earlier, I forget to mention that everything worked out and I found a way to make OC work with fully private bucket and now we have it running in PROD!
Ken Crawford
@kmcrawford
👍🏻
Matteo Figus
@matteofigus
Very nice!
Shinu Pushpan
@shinup
Hello I am trying to understand how Registry Rest API works . Tried to follow the documentation at https://github.com/opencomponents/oc/wiki/Registry . I am bit puzzled about how the registry will work if I want to host the registry in a AWS ECS (EC2) instance.
playforada97
@playforada97
Hi I am setting up OC project
oc init hello-world throwing error -bash: oc: command not found
https://github.com/opencomponents/oc/wiki I am following this instructions
ALex
@aresobus_twitter
@playforada97 run ```npm install -g oc```` it looks like you don't have framework installed
Matteo Figus
@matteofigus

Hello I am trying to understand how Registry Rest API works . Tried to follow the documentation at https://github.com/opencomponents/oc/wiki/Registry . I am bit puzzled about how the registry will work if I want to host the registry in a AWS ECS (EC2) instance.

@shinup after deploying the registry, you should have a base url you can use with the CLI. An easy way to get started with AWS is to use docker for the registry and use Elastic Beanstalk - an example of a container https://github.com/ciricihq/oc-docker

yugandhar-pathi
@yugandhar-pathi
@matteofigus i am new to open components .... after spending sometime i understand that it helps us to stitch micro front ends together ..is my understanding correct ?
Matteo Figus
@matteofigus
Yes
Ken Crawford
@kmcrawford
@matteofigus can I get a publish of storage-adapters?
Matteo Figus
@matteofigus
done @kmcrawford ;)
Anıl Aküzüm
@akuzumanl_twitter
How is the standard react web project configured with open component?
Ken Crawford
@kmcrawford
@yugandhar-pathi are you looking for something like this? https://github.com/opencomponents/react-oc
Matteo Figus
@matteofigus
Have a look at this one - it's the most updated one https://github.com/opencomponents/oc-template-react
marcabisamra
@marcabisamra
Hi 🙋🏻‍♂️are there any good video tutorials to get started with open components?
marcabisamra
@marcabisamra
We keep getting Registry not started: components_list_get with both the Getting started with Heroku and trying to get started locally
any way to get more information on whats going on? Followed this Heroku guide step by step and heroku outputting this
2021-03-15T20:23:45.713168+00:00 app[web.1]: > opencomponents-starter-kit@1.0.0 start /app 2021-03-15T20:23:45.713169+00:00 app[web.1]: > node server.js 2021-03-15T20:23:45.713169+00:00 app[web.1]: 2021-03-15T20:23:49.694652+00:00 app[web.1]: Registry not started: components_list_save 2021-03-15T20:23:49.842166+00:00 app[web.1]: npm ERR! code ELIFECYCLE 2021-03-15T20:23:49.844844+00:00 app[web.1]: npm ERR! errno 1 2021-03-15T20:23:49.887172+00:00 app[web.1]: npm ERR! opencomponents-starter-kit@1.0.0 start:node server.js`
Matteo Figus
@matteofigus
@marcabisamra I think that issue occurs if the application has no write/read permission to the S3 bucket. Can you check your bucket policy?
marcabisamra
@marcabisamra
That was it, thank you @matteofigus !
Matteo Figus
@matteofigus
no problem :thumbsup:
marcabisamra
@marcabisamra
When trying to use plugins (custom or from npm), I am constantly seeing an empty {} for context.plugins on the server even though i'm following the Wiki line by line on how to register them.. Is there a common mistake or something else I should know outside of the Register#plugins section of the wiki? @matteofigus 🙏
Diana Tamas
@dianatamas
Hi, we have been trying to migrate our registry to Kubernetes, but we're facing some issues, mainly when trying to get the list of existing components. We get the following error Error: EACCES: permission denied, mkdir '/srv/app/temp' at Object.mkdirSync (fs.js:921:3). I haven't been able to find where in the code mkdir is called (and why), does anyone have an idea? For more context, we are calling 127.0.0.1:8080/v2 (where /v2 is the prefix that we passed in the registry options, and 8080 the port in the options) in order to get the list of components
Matteo Figus
@matteofigus
@dianatamas when you publish a component you do a PUT to the registry, which is an express app using the multer module that uses a temp folder to save the package before uncompressing it and uploading objects to s3. I suspect the express registry is trying to create the temp folder at launch. You can override that setting in the config. Here is the default: https://github.com/opencomponents/oc/blob/master/src/resources/settings.js#L15
Maybe you can keep the settings as they are, but make sure the app can have write access to that folder
Matteo Figus
@matteofigus
@marcabisamra consider that you get the context.plugins in the registry when you run it with your storage. If you run the registry with the initialised components and you run a component using a valid plugin, and you don't see it there, the plugin may be invalid or not working correctly. But remember that when running locally in dev mode, plugins are not available so you need to mock them: https://github.com/opencomponents/oc/wiki/Cli#mock
Diana Tamas
@dianatamas
Thanks @matteofigus , I ended up changing the default setting and it worked!
Matteo Figus
@matteofigus

Thanks @matteofigus , I ended up changing the default setting and it worked!

:thumbsup:

nico-villalonga
@nico-villalonga
hi @matteofigus, is there absolutely no way to test plugins locally? I'm using oc-graphql-client and cannot test the endpoint until I deploy the component?
Will be using jwt and some customs as well. Having to mock every component is gonna be hard.
Also, is there a way to unmock components? oc does not provide command for that/
Matteo Figus
@matteofigus
The problem is that conceptually plugins are supposed to be layers on top of the registry and the dev mode is supposed to be a sort of a mock itself. What I remember doing, for most of the plugins, was to create a mock that shared the same code of the actual plugin. If you do that, you basically need to spend a bit of time wiring up things, but you should be able to test things locally quite effectively. I am not sure if I can find some examples right now...
This is a PR we made ages ago to enable that...in practice you can have mocks that have the exact signature of the plugin, and you can require the graphql plugin inside your mock... opencomponents/oc#794
Matteo Figus
@matteofigus
@nico-villalonga try setting up the mock as external js file and try writing a wrapper that requires the plugin and exposes the exported methods, it should work. If you have troubles let me know
In regards of "unmocking" the cli just operates with a oc.json file with the mocks stuff, you can just edit that file to edit your mocks
nico-villalonga
@nico-villalonga

@matteofigus thanks for your quick response. I see the oc.json, I'll remove from there if needed then :+1:

I tried the wrapper approach, not sure if understand correclty. I created a file graphql.js under /plugins/mocks and registered the plugin with
oc mock plugin graphql plugins/mocks/graphql.js. registered succesfully, but when executing the query const response = await context.plugins.graphql.execute.query({ query }); then Im getting this error TypeError: Cannot read property 'query' of undefined.

the file looks like this:

`
const graphqlPlugin = require('oc-graphql-client');

// module.exports.register = () => graphqlPlugin.register;
module.exports.register = (_opts, _dependencies, next = () => {}) => {
// next function?
graphqlPlugin.register({ serverUrl: 'https://graphql.bitquery.io/ide/SKHzG7zMJS'}, [], next)
return next();
};

module.exports.execute = () => graphqlPlugin.execute();
`

Matteo Figus
@matteofigus
so I think the execute method is just the one you use to call in the registration, so you should be able to access it just by doing const response = await context.plugins.graphql.query({ query });
(just using my memory here, can you try to console.log(context.plugins)?
nico-villalonga
@nico-villalonga

I did a console.log on the register function (the mock, before delegate to the library) and its writing to console.
also added console.log(context.plugins) on server.ts, right before the query execution and getting this output { graphql: [Function] }. so I changed the execution statement to const response = await context.plugins.graphql().query({ query }); (notice the () right after .graphql), and this result in this error:

{ "errors": [ { "message": "Invalid response from graphql server.", "http": { "status": "Not Found", "code": 404, "body": "<!DOCTYPE html>\n<html lang=\"en\">\n<head>\n<meta charset=\"utf-8\">\n<title>Error</title>\n</head>\n<body>\n<pre>Cannot POST /SKHzG7zMJS</pre>\n</body>\n</html>\n" } } ] }

Matteo Figus
@matteofigus
aha ok I think that's good progress
I think the mock is now at least working