-
Notifications
You must be signed in to change notification settings - Fork 737
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Beginner - Apollo installation page appears to be out of date. Can I help? #1233
Comments
Hi, where are you running into problems? It would help me fix the docs to know where something's not working. |
There also is already a step by step tutorial available here. |
The step by step example seems to be more complete, I will try and work through that - is there a reason why this isn't linked instead of the current main page? I will work through it and capture any issues. Thank you very for the help, I'm glad to help as much as I can in return. |
I'm getting the error below in xcode when attempting the build. I removed the package dependency (from the original install) and reinstalled, adding web sockets as indicated, and also the code generation, but still see this error. It looks like it's not getting through the first few lines of the script - but not clear (at least to me) what the script is looking for. error: Unable to locate SourcePackages directory from BUILD_ROOT: '/Users/lastneutrino/Library/Developer/Xcode/DerivedData/Build/Products' |
I updated the intro page yesterday to make the link to the tutorial more prominent.
The script is looking through the Usually there's a Tangentially, this whole process is ultimately part of why we're switching to Swift-based scripting (currently in beta) in the long run, because treasure hunting for the source packages in the derived data directory is not a super-stable way of doing this. |
Build doesn't look to be at the sibling level, is something else wrong? % pwd I tried the beta as well - schema.json didn't download from server. There is actually another Codegen directory appearing under Codegen/Sources - I tried to remove it, thinking that might be a redundant redundancy, but it wouldn't build without Sources/Codegen - Package.swift complained. No mention in cli about the Codegen directory scripts failing, or doing anything, will try again tomorrow with a fresh project, I wonder if something else is wrong. Hello world! displaying was the last verified function output. |
So the script does look at the sibling level - let me break this down a bit. Here's the bash code in question:
First line should give you a path like: while loop 1: Does The script then sets the Regarding the |
Intermediate - if i keep the 27.0 as a dependency, i get the following error, which is removed when depending on 28.0 instead. I'm attempting to rebuild from scratch with beta. Resolving https://github.com/kylef/Spectre.git at 0.9.0 *project/Codegen/.build/checkouts/Stencil/Sources/Template.swift:11:3: warning: 'internal(set)' modifier is redundant for an internal property |
@lastneutrino What version of Swift are you using? As of 5.2 that deprecation should be a warning rather than an error (unless you're doing treat all warnings as errors, which I would not recommend for the scripting project). |
Swift version below. No warnings to errors. Further, I created a new blank single page app. I followed the beta instructions - I'm able to get Hello World, but after that I left "MyProject" as-is which doesn't seem to be created, and no schema.json. I'm able to bring up the playground in the web browser. What am I missing here? % swift --version % find . -name "ApolloCLI" % find . -name "schema.json" import ApolloCodegenLib let parentFolderOfScriptFile = FileFinder.findParentFolder() let cliFolderURL = sourceRootURL let endpoint = URL(string: "http://localhost:4000/graphql")! let output = sourceRootURL try FileManager let options = ApolloSchemaOptions(endpointURL: endpoint, do { |
The So I would take a look at how you've got your project set up. This is roughly the structure you're going for:
The |
I do have the structure you are indicating. The implication I get from the beta page from "Build and run using the Xcode project. Note that if you're on Catalina you might get a warning asking if your executable can access files in a particular folder like this:" is that building, in this case, "TestCodegen", would perform 'swift run'? Assuming that assumption is not true, if I run 'swift run' in the same directory as the main.swift file, I get errors related to URL and FileManager not found. If I import the Foundation class, I get the following errors if I run 'swift run': TestCodegen/Codegen/Sources/Codegen/main.swift:23:2: error: value of type 'FileManager' has no member 'apollo_createFolderIfNeeded' is this because I'm running 28.0? Am I correct in thinking that the build will not run this script automagically? |
Aha, a couple of things:
|
(#1252 has those updates) |
I was building the top level project, not the Codegen project. If the codegen executable is expected to be invoked when the top level project is built, that's not happening. The ApolloCLI folder is populated when I build the Codegen project, not the top level project. As a result of this, the ApolloCLI directory is populating, I see the .zip file, but not the schema.json. The CLI log on the first run reported this, but when I re-run, I do not see output although "All Output" is selected. Output of the CLI when shut down, restarted and re-built Codegen:
|
The Also, can you clarify what you mean by "Top level project" - if you can post a screenshot of the generated schemas with the one you're using selected, that'd really help disambiguate. |
Top level project == MyProject which is TestCodegen in my example. Are you looking for main.swift? It's below. I can upload the whole TestCodegen directory as well. Note that I ran the Codegen project to get ApolloCLI populated, but TestCodegen did not run the script. Note that I am not seeing the schema.json indicated in the CLI log, and a find command does not locate one.
|
So from the code you posted, taking a look at this line: let output = sourceRootURL
.appendingPathComponent("MyProject") If
|
That's a mistake on my part - that part should have been the following:
for some reason - the CLI started responding with that the introspection request was HTML instead of JSON. I added introspection: true to the server, /graphql to the endpoint, and the schema finally appeared. I backed off both the introspection variable and the endpoint modification, and it's still downloading the schema. I'm not quite sure why the CLI started responding or why it suddenly started working. |
Yeah, I'm not sure - it does sound like something changed on the server side if the same code suddenly started working. No idea what, though. Gremlins? 🙃 |
I would assume the problem is between the chair and keyboard. I'm wondering if the decision to write to "MyProject", assuming that the directory would be created in parallel, wasn't true, and I changed come client code in between "TestCodegen" and "MyProject". I'll update when I have the complete chain working, and I'll repeat it to make sure it's functioning. I do see this warning: which is odd, since the package dependency above says 0.28.0. Seems like everything is off there. |
Yeah that warning is from our JS CLI, which is used under the hood, and which is currently at 2.28.x. I know that's confusing - hopefully as they continue releasing and we continue releasing that will diverge. |
Please take a look at #1263 - I've made more changes to the swift scripting instructions to make them clearer. Once that gets merged I'll close this issue out, but would love to hear any feedback. Thanks! |
Updated swift scripting docs have shipped! I'm going to close this issue out since it's so general, if you have additional problems, please open a new issue with specific details on where you're having a problem. Thank you! |
I set up Apollo server, very easy. I was able to install the iOS client package dependencies, but the rest of the instructions at
https://www.apollographql.com/docs/ios/installation/
didn't match the latest xcode and apollo-ios client. If someone could work with me to get the client going, I would be glad to write a new tutorial for iOS client, and include more examples.
The text was updated successfully, but these errors were encountered: