-
Notifications
You must be signed in to change notification settings - Fork 743
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
Unable to run code generation #2543
Comments
Just ran into the same issue 😕 |
Thanks for the bug reports. We made a fix for this type of error last week. There is also a test that's able to call the CLI and succeed. This is weird.. |
A quick thought - I wonder if it's related to not using the --path command, which means it's looking for the config file in the location of the CLI binary? init didn't fail though so it seems it was able to write the config file to that location though. Try this as a workaround - use an external path for both init and generate. See if that works because it then wouldn't be looking in the .Pods folder. |
Thanks @calvincestari , unfortunately adding the |
Ok, I'll have to dig into it a bit later; we're all en route to Summit at the moment. Will try take a look later today. Apologies for the delay. |
Hi, The same issue here. |
same problem here, struggling for 4 days and couldn't solve it please help |
Same problem. Can't sleep, the customer is rushing the work. I'm really looking forward to news about the fix. |
@indama - make sure you're building for mac only. |
@calvincestari Hi there! Had a quick question regarding the errors @indama is hitting, as my team just hit the same problem. Is there a reason why ApolloCodeGenLib used to work for iOS? We set up an iOS project a few weeks ago and followed the documentation at the time that recommended using ApolloCodeGenLib over deprecated bash scripts for automatic code generation. I don't recall the docs mentioning macOS only anywhere, and it was working great for us on iOS until this week. We're trying to transition to the new Codegen CLI now. |
I'll be honest; I find the instructions to get code generation to work in 1.0 to be very confusing. Looking at the available options listed in the documentation to install the codegen CLI:
Any help would be appreciated... |
We are also using Xcode to manage Swift packages, so we were also a bit confused on how to set that up. Specifically, it was unclear how we can edit the Possible workaround for editing configuration file when using SPMA workaround I tried with the SPM solution was opening the Schema fetching errorsBut when attempting to fetch the schema, we're still running into errors. We've tried with two working graphql endpoints and have gotten the same error with both of them. We are unclear as to if there is a problem with our configuration, or if there is a bug of some sort here. The main error we keep getting is:
It also looks like its having an issue reading from a cache, as we get this error as well:
|
I am getting similar issue when trying to run cli (get via Pods):
|
@sammcode I think there might be some confusion between ApolloCodegenLib and the new apollo-ios-cli. ApolloCodegenLib has always only been designed to run on macOS because code generation does not need to be executed on mobile devices. You can view the ApolloCodegen class from v1.0 moves away from recommending that code generation be executed with each build, which is what the bash scripting help before recommended. Note that you can still take that same approach but using the new apollo-ios-cli instead of the legacy Apollo tooling CLI; very similar names I'm sorry. |
@SilverTab your make build error seems pretty odd; PackageDescription is a Swift Package Manager defined object so as long as the dependencies are fetched correctly it should all be there. Could you try resetting the package cache or dependencies and see if that helps resolve that error - |
Hi @calvincestari regarding to the issue we faced, we are going to downgrade to 0.53.0 version and, continue working. What do you think? Is it solid decision or Should we wait for a new Codegen CLI? |
After upgrading to 1.0.0 i also encounter issue during the codegen phase:
|
Thanks for pointing me in the right direction... I was able to get it to build by first doing: |
Update: We know the root cause of the the issue with running Codegen when using CocoaPods. @calvincestari is working on the fix for that now, and we will have it released ASAP!
@SilverTab Thank you for the feedback! We will work on trying to make the documentation clearer next week as well.
I'm looking into this now. We were under the impression that this would still work the same, but if we were wrong there, this is definitely an oversight on our side. We will have a resolution for you ASAP. |
@AnthonyMDev @calvincestari Thanks guys, can't wait for it! btw. If i am using multiple apollo schema endpoints, i am wondering if it possible to specify it in |
@SilverTab You can run the plugin commands using Xcode like this. I'll update the docs to add this next week! |
@m1entus I'd love to talk more about this use case and understand what you want to achieve there. |
Looks like we need to explicitly support the use of the package plugin from within the Xcode project. This was an oversight on our side due to not knowing about this... We'll get it working and update this thread as soon as we do! |
Reopening this issue until we've fixed the Xcode project plugins workflow. |
@elviva404 It looks like something is wrong with your schema here. It might be that you have named the query In your |
This issue has been closed as the specific cause of it has been corrected. The fix for this will be released in 1.0.1 very soon and is available right now on the If you are having other problems with codegen, please submit a new issue! Thanks to everyone for all the info as we work this out. We unfortunately did not get enough users during the Beta period to find these edge cases. So we are working quickly to resolve all of them now and will release a patch version ASAP! |
Thanks |
@elviva404 Please keep me updated. Want to make sure you're able to get this working! |
Thanks for the update @AnthonyMDev - appreciate you and @calvincestari replying to us all and sorting these issues so quickly. |
Hi, @AnthonyMDev I'm getting a similar error as @elviva404: I'm trying to generate code following this steps using cocoa pods and Apollo 1.0.1.
Queries.graphql:
schema:
Why I'm getting this error? Thanks |
@DavidFerreiraYEO, that looks like a GraphQL syntax error. Have you confirmed that your query works in Apollo Studio or GraphiQL? If it works there it should work for code generation. If not, get it working there first. |
It works on GraphiQL. |
I have a feeling that we aren’t emitting an error when the schema isn’t picked up by the code gen engine. This looks like the schema path is not picking up the schema. That may be why it doesn’t recognize the field. |
@calvincestari @AnthonyMDev I just re-do everything in a clean project: steps I have done:
now I'm getting different output:
This fields are nothing related to my schema. |
@DavidFerreiraYEO I've seen that error when codegen ends up finding all the test schemas we use in the repo. We have #2552 to fix that behaviour. The workaround for now is to put your schema and operation definition files in a subfolder and not the root of your project. An example is putting them in a subfolder off the root named |
@calvincestari I create the folder graphql.
|
You have a schema json file so your schema search path should be |
Hi @AnthonyMDev, that's the reason. Thanks for your help. |
Hi @AnthonyMDev it works now 💃🏾. |
@AnthonyMDev @calvincestari Is there anything we can do to get v1.x working? Or is it time to punt and go back to the .59 release? I need to move on, but can't really be beta testing this right now. I think I got the init and fetch phases done via the cli. But, the generate, is crashing hard ( I just need good avice here. If there is a work around, I'm all for it... if not, I need to know so I can downgrade and move on. Is there any downside to the downgrade? Is it just the codegen that's different? Or is the 1.0 client better (more peformant, more stable, etc)? |
@sam961 I think your issues might be caused by the |
@tlester, answers below
I'd need to know more about what your specific issues are. I see that you reacted to this comment so if your error is the same as what SilverTab was experiencing then I believe it was resolved for him by resetting the package cache.
Is there any other error message?
Once we understand more about your specific problems we can help. This particular GitHub issue has become clouded with too many individual threads. I believe we've addressed the bugs related to this original issue in The generated code in 1.x has many improvements. The 1.x documentation can certainly be improved to offer better guidance and self-serve many of the problems reported. |
For anyone watching this issue and dealing with error responses that look like
#2567 has been merged and has better error responses when the schema or operation files cannot be found in the search paths. That was the root of that issue. You can link to |
@sammcode were you able to get past this issue? I am currently having the same problem. |
The schema fetching errors are because the SPM plugin is in a sandbox and won't allow the disk read/write and networking mechanisms of the fetch schema command to work properly. You can try passing the Version 1.0.4 which is coming soon removes the existing SPM plugins and instead has a single plugin command that installs the CLI, you can then use the CLI from the command line and all these SPM plugin permissions issues go away! |
Hi @AnthonyMDev I replaced
is there something I have done wrong in my setup? a prompt response would be appreciated please. |
@elviva404 I've never heard reports of us generating empty files before. Try just deleting the |
I am locking this issue now. The original problem has been resolved, and people are using this closed issue as a catch-all for debugging multiple different configuration errors with code gen. This means everyone who has ever commented here (and has had their issue resolved) continues to get notifications. If you have an problem with getting code generation working, please open a new issue. Thank you. |
Bug report
Installing Apollo 1.0.0 via Cocoapods results in code generation error.
Versions
Please fill in the versions you're currently using:
apollo-ios
SDK version: 1.0.0Steps to reproduce
pod init
Add
pod 'Apollo'
pod install
./Pods/Apollo/apollo-ios-cli init --schema-name MySchema
./Pods/Apollo/apollo-ios-cli generate
Further details
Note that cocoapods is installed using Hombrew.
The text was updated successfully, but these errors were encountered: