Comments (8)
Hi. Thanks for opening the issue, and sorry for the delayed response.
Unfortunately I have no idea how resources work on Linux, but I'll ask around.
By the way, can you share some code? Particularly how you're trying to access that folder?
from heroku-buildpack.
Also, do you have that "SpotifyWebAPI.doccarchive" folder committed to source control? The buildpack, especially on Swift 5.4 and before, will not compile DocC by itself.
from heroku-buildpack.
Do I assume correctly that you are trying to deploy this project? https://github.com/Peter-Schorn/SpotifyAPIDocs
from heroku-buildpack.
Doubling down on that "help-wanted" label, I deployed your repository to Heroku and found this in the logs.
(Sidenote: it would've been useful to have this in the original issue.)
2021-06-29T18:30:48.624997+00:00 heroku[web.1]: Starting process with command `Run serve --env production --hostname 0.0.0.0 --port 4728`
2021-06-29T18:30:52.295359+00:00 app[web.1]: VaporDocC/resource_bundle_accessor.swift:11: Fatal error: could not load resource bundle: from /tmp/codon/tmp/cache/heroku-20/swiftenv/versions/5.4.2/usr/bin/SpotifyAPIDocs_VaporDocC.resources or /tmp/build_a14d8f44/.build/x86_64-unknown-linux-gnu/release/SpotifyAPIDocs_VaporDocC.resources
2021-06-29T18:30:52.791165+00:00 app[web.1]: 0x7f3bbe6c03bf
2021-06-29T18:30:52.791183+00:00 app[web.1]: 0x7f3bbe843307
2021-06-29T18:30:52.791184+00:00 app[web.1]: 0x55dc9ded7ad7, closure #1 () -> Foundation.Bundle in variable initialization expression of static (extension in VaporDocC):Foundation.Bundle.module : Foundation.Bundle at /tmp/build_a14d8f44/.build/x86_64-unknown-linux-gnu/release/VaporDocC.build/DerivedSources/resource_bundle_accessor.swift:11
Unfortunately, this suggests that Swift hardcodes the build path to the binary, so even though the resources folder is copied right next to the binary (which is done by the buidpack), the app will not see them.
from heroku-buildpack.
Do I assume correctly that you are trying to deploy this project? https://github.com/Peter-Schorn/SpotifyAPIDocs
Yes, I want to deploy this project.
Unfortunately, this suggests that Swift hardcodes the build path to the binary, so even though the resources folder is copied right next to the binary (which is done by the buidpack), the app will not see them.
I assumed that the resources folder was not copied at all. Is there any way I can reliably retrieve the correct path to the resources folder? Perhaps I should create a docker image instead and deploy that. However, I'm not sure how to correctly set up that either.
It doesn't matter to me how resource access is implemented; I just need a reliable solution.
from heroku-buildpack.
If you want a reliable solution, don't use Bundle.module
until we can figure something out.
I have two workaround ideas in the meantime:
- Stick to serving files directly from the project folder (like FileMiddleware).
- Use
Bundle(path: "/app/.swift-bin/SpotifyAPIDocs_VaporDocC.resources")
before Bundle.module – that's the path where the resources are copied by the buildpack.
from heroku-buildpack.
For the record, I found where the hardcoded temporary paths are coming from in SPM's sources.
I have absolutely no idea why it's implemented like that, and why the toolchain's bin folder end up being used as the main bundle path. Or how Swift apps with resources are supposed to be portable between systems...
from heroku-buildpack.
I've found a bug report about this exact issue, and it will be fixed in Swift 5.5. The fix is already part of the 5.5-DEVELOPMENT-SNAPSHOT-2021-06-26-a version, which is supported by the buildpack, I've just finished testing it.
So, for the third workaround, you can set the Swift version used to 5.5-DEVELOPMENT-SNAPSHOT-2021-06-26-a
with either a .swift-version
file or with the SWIFT_VERSION
config variable and build again.
Until 5.5 is released, unfortunately there is nothing I can do to fix Bundle.module.
from heroku-buildpack.
Related Issues (18)
- No such file or directory HOT 1
- Update buildpack for Swift 4 and newer clang
- Fix ubuntu version detection
- xz:(stdin): File format not recognized HOT 5
- swiftenv fails on heroku push HOT 4
- Heroku build fails HOT 4
- Request: Support Heroku 18 stack HOT 7
- Support Package.swift symlink? HOT 5
- Error while using swift 5 HOT 2
- No such module 'CommonCrypto' HOT 2
- Migrate away from swiftenv HOT 1
- Building failing on release script HOT 1
- Heroku build failed to compile Swift app HOT 1
- Support for Heroku-20 stack HOT 3
- updated to latest buildpack and heroku-20: No available connections on this event loop, creating a new one [database-id: psql] HOT 2
- Support for resources
- Heroku-22 stack HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from heroku-buildpack.