GraphQLError: Unknown directive "#link" - apollo

Trying to test the new Apollo Federation 2 and followed the documentation as specified.
To create a 'true' federation 2 subgraph, the docs ask to put the following in the typedef:
extend schema
#link(
url: "https://specs.apollo.dev/federation/v2.0"
import: ["#key", "#shareable"]
)
Unfortunately, this addition didn't work for me as I got the following error:
GraphQLSchemaValidationError: Unknown directive "#link".
GraphQLError: Unknown directive "#link".
Library versions:
#apollo/subgraph 0.4.0
apollo-server 3.6.7
graphql 16.3.0

Could you link the Apollo Federation documentation which made indicated that you should be using the #link directive?
I also set up an Apollo Federation 2 server - but followed along this tutorial: https://www.apollographql.com/docs/federation/v2/quickstart/setup . I did not come across a #link directive, but I might have just followed a different tutorial. Just adding a reference to it here incase it helps you.
I also think that #link might not be an already implemented directive due to this: https://github.com/graphql/graphiql/issues/892 . Did you want to add in a custom directive?

Related

Problems with es6 modules such as socket.io-client which I downloaded with npm while using Flask as backend

to sum up my circumstances:
I am running everything locally
I am using flask in the backend within a virtual environment
Goal: build a socket connection between Flask Backend and JS Frontend
PROBLEM: the problem is in the Frontend which is based on JS where I can't import the modules I got with npm
I am importing the modules as follows:
import { io } from "socket.io-client"
import { Hands } from "/#mediapipe/hands"
I also tried different import variants such as import * as io from "socket.io-client" and I also tried importing directly files as follows: import {io} from "socket.io-client/dist/socket.io", but all without success as these lead to "not found" errors.
I am sure that I installed them correctly with npm as I can see them in the folder structure, but the es6 imports are throwing an error as follows:
Failed to resolve module specifier "socket.io-client". Relative references must start with either "/", "./", or "../" - To solve this I tried adding slashes to different places like in the html tag where I include the script I tried transforming "type="module"" to "type="/module"" as recommended somewhere online, but without success. Also building direct references in the imports like "./node_modules/socket.io-client" do not work as it states that the file/folder is not found.
The problem must be the usage of the imports as everything works when I use Content Delivery Networks which also lets me assume that the version of the packages is not the problem as the version I get from the CDN is the same, but still the versions I use:
socket.io-client: 4.6.0
#mediapipe/hands: 0.4.1675469240
Flask: 2.2.3
Flask-SocketIO: 5.3.2
npm: 8.19.3
node: 16.19.1
My folder structure is as follows:
venv
main.py
templates
index.html
static
node_modules (includes socket.io-client and #mediapipe/hands)
js
main.js (the js file where the problem occurs)
package.json
I read a few times that the usage of "Webpack" is recommended, but I would like to skip that currently as I am not very familiar with that, so one question would also be: is it necessary to use it?
What can I possibly do wrong or how can I track my problem when it is about the import of es6 modules?
I would appreciate any help. Thanks in advance!
I could solve my problem for the socket.io-client package:
For the socket.io-client I imported a specific file directly although I do not really know why it worked as follows:
import { io } from './node_modules/socket.io-client/dist/socket.io.esm.min.js'
For the mediapipe package I still could not import the module in my js file directly and I am still relying on CDN. I tried the same thing in the same way by using:
import * as Hands from './node_modules/#mediapipe/hands/hands.js'
This, at least, does not result in an error, but the usage of "Hands" in this case is unclear to me as there is also no documentation for this use case in the mediapipe-js documentation. I could not directly import the {Hands} function as it resulted in an error saying "there is no function Hands in that path"

How to import an existing library into Go 1.11 as a module?

I am trying out Go 1.11 beta2 with this modules support https://tip.golang.org/cmd/go/#hdr-Modules__module_versions__and_more.
I have created go.mod file looking like this:
module example.com/m
require github.com/aws/aws-sdk-go/aws v1.15.0
require github.com/aws/aws-sdk-go/aws/session v1.15.0
require github.com/aws/aws-sdk-go/service/s3 v1.15.0
But this shows me an error when trying to build:
go: github.com/aws/aws-sdk-go/aws#v1.15.0: unknown revision aws/v1.15.0
go: github.com/aws/aws-sdk-go/service/s3#v1.15.0: unknown revision service/s3/v1.15.0
go: github.com/aws/aws-sdk-go/aws/session#v1.15.0: unknown revision aws/session/v1.15.0
go: error loading module requirements
So, I have a question, should I wait for the moment vendor adds support of modules versions into the library before I can import it using go modules or is there some other syntax I can use right now?
Your module's go.mod should require entire modules.
Try replacing:
require github.com/aws/aws-sdk-go/aws v1.15.0
With:
require github.com/aws/aws-sdk-go v1.15.0
You can see the AWS SDK module is defined as github.com/aws/aws-sdk-go here:
https://github.com/aws/aws-sdk-go/blob/master/go.mod
See also this example of a real repository depending on multiple modules from other repositories:
https://github.com/google/go-cloud/blob/master/go.mod

WebStorm with Babel not working with import statements

I'm using WebStorm 2017.1.3, although also tried with latest EAP, and i can't get import from statement to work. I just keep getting the following error:
import Utils from './utils'
^^^^^^
SyntaxError: Unexpected token import
In my packages.json i have babel-cli, babel-preset-env and babel-preset-es2015 defined. I have followed various blog posts and videos but still get same error.
ES6 is enabled in settings and i tried adding Babel file watch as per documentation but nothing seems to work. This feels like it should be a lot easier and just work, so i must be missing a important part of the jigsaw.
Does anyone have a working step by step, from fresh project, how to guide in configuring webstorm to work with import ?
Some places say use file watch, others say just to change project configuration interpreter to use babel-node. Other say must use Gulp... very confusing.
Thank you.
fLo
To make things clear: this is not about configuring WebStorm, error comes from Node.js interpreter that runs your code. Node.js still doesn't support ES6 modules natively (actually, no JavaScript runtime currently supports them - ECMAScript does not define a "Loader" specification which determines how Modules are inserted into the runtime. The Loader spec is being defined by WHATWG, but is not yet finalized). So, to get ES6 imports/exports accepted, you need using transpilers. Current industry standard is Babel
The most simple way to make it work is the following:
install babel in your project using npm install --save-dev babel-cli babel-preset-env
create a .babelrc file in project root dir:
{ "presets": ["env"] }
in your Node.js Run configuration, pass -r babel-register to Node:
With this configuration, your code will be transpiled on-the-fly by Babel, no file watchers, etc. are needed

Specifying a django download link in djangorecipe with buildout

I want to deploy my django project using buildout, so I use djangorecipe, but
It will automatically download Django
as says in the readme, and I want to have the option to specify a url to download django (i.e. from a pypi server).
I try to set it with index and find-links buildout options but when they say automatically is true.
I searched through several recipes and found out 2 djangorecipe's forks that seem go in a similar direction, these are thechristmaspig and djbuild. The first left the download responsibility to the recipe zerokspot.recipe.git and the second allow to specify a svn repo. But both of them haven't recent activity (more than 2 years) and a very small community, that poor support make me out.
Can you suggest another way without hacks djangorecipe?
UPDATE:
I had tested with some options without success:
mr.developer:
In djangorecipe mentions use this recipe and I try with fs option of source but no way with an url like this:
[sources]
django = fs http://pypi_server/simple/
I tested with several settings but it seems only works with directory in file system
zc.recipe.egg:
But it also use the same url of the djangorecipe and no found a way change it
UPDATE2:
gp.recipe.pip:
Same results of zc.recipe.egg, but notice something: If remove the use of djangorecipe i.e. (commenting this section):
[buildout]
parts = pip
[pip]
recipe = gp.recipe.pip
install = django
#[django]
#recipe = djangorecipe
#settings = settings
it download django from the local pypi server. With django enabled (uncommenting django section and add django to buildout:parts) it download from www.djangoproject.com server.
In order to execute gp.recipe.pip first (so djangorecipe found django installed) I'm tried with two ways for refering a variable:
Refering a pip's variable from django section (as explain in the section "Automatic part selection and ordering" of buildout docs)
Proceding with section Extending sections (macros) of buildout docs
Note that reorganize sections or change the values order in parts variable no matters for change the execution order.
But again no success
Any ideas?
Thanks
Based on the UPDATE2's comments in the question I figure to have two .cfg files: the one with only pip settings and the second for django settings. Then execute twice buildout using -c option to specify files. So with first buildout call it installs django from pypi server, second encounter that django has been installed and move on. This should works and maybe this is the solution, any other? thx

oracle integration repository package

I am new to Oracle and have been having trouble following instructions for importing a package into the integration repository.
The instructions include code for creating a package and body, but don't really tell me what to do with that code. It looks like I should run it in SQL Plus. Is that correct?
It also includes instructions for generating the ILDT file--but only in a generic way. Those instructions just refer me to the "SOA Gateway Implementation Guide". (http://docs.oracle.com/cd/E18727_01/doc.121/e12169/T511175T543269.htm) The command is:
$IAS_ORACLE_HOME/perl/bin/perl $FND_TOP/bin/irep_parser.pl -g -v -username=sysadmin itg:patch/115/sql:fndav.pls:12.0=/tmp/fndav.pls
I'm not sure what to use for the .pls file. Is that generated and then the ILDT file is also created?
Apologies for this newbie question.
I appreciate any help!
Thanks,
Sami
You probably figured this by now, as per oracle conventions .pls file is the package specification and .plb is for package body.