error when trying to generate a pdf with KNP Snappy (but only in one place) - wkhtmltopdf

In a symfony4 project I use KNP Snappy with wkhtmltopdf to generate pdf-files. This works on my computer and on my server. On my server I have created a folder called 'dev' where I can test my project (I have created a copy there). When I set the .env file to prod in my test-project all works fine, including generating pdf-files.
Here's the odd thing: on my actual production site (in the folder above) all code is exactly equal to the project in the 'dev folder', however whenever I try to generate a pdf-file I get a good old 500 Internal server error.
This is my config-file knp_snappy.yaml:
knp_snappy:
pdf:
enabled: true
binary: '%kernel.root_dir%/../vendor/h4cc/wkhtmltopdf-amd64/bin/wkhtmltopdf-amd64'
options: []
image:
enabled: true
binary: '%env(WKHTMLTOIMAGE_PATH)%'
options: []
This should just work, but it does not. I tried changing the files around, changing the paths, but no luck. Could it be a folder permission issue? What else could be different between the two projects since the code is exactly the same? It's hard for me to solve this issue because I cannot reproduce the problem when testing and I can't find out anything about the error. Any help is greatly appreciated.
Update of what I tried so far: I reinstalled the dependencies. I changed the permissions for the folder tmp, I made sure the pdf I tried to generate did not contain anything. I cleared the cache (obviously), but still an error.

I managed to find the problem. The file wkhtmltopdf-amd64 did not have the right permissions set. I needed execute permission, so I set it the permissions to rwxrw-r-- (0764) and now it all works. For some reason in the dev-folder the file DID have execute permissions set.

Related

Sonar Strange Encoding Issue?

I recently rolled out an update for Jenkins to kick off sonar-scanner on version 5.6 of SonarQube. I'm not using the plugin, just a command line call of the sonar scanner from the directory where the sonar-project.properties file resides.
So far all of the developers have followed the same steps, and configure the properties file for their services and works great except in a few cases. Two developers have had a strange issue, when an error message prompts:
"Caused by: Not authorized. Analyzing this project requires to be authenticated. Please provide the values of the properties sonar.login and sonar.password."
I thought this to be strange because the other developers would probably have the same issue if the authentication token I used in the instructions was wrong. I compared a working copy with the version the first developer and the only difference was the project specific things such as DLL name, version, etc... I'll provide a template below. With the file looking fine, I saved off the broken copy, and copied the contents of another working copy into the broken copy. I then changed the project specific properties, and commit into subversion. Sonar scans successfully!
Out of curiosity, I then compared the old broken file and the new working copy line by line. Their was absolutely no difference between any character. I then thought this must be an encoding issue. I did a quick test by adding the sonar encoding property, commit this back and the scan failed. So I then changed back to the working copy and just continued.
The next day a second developer came to me with the same exact issue. I then tried the same previous steps where I copied the contents of a working copy, and pasted into the new, and commit this back in. However this time the workaround did not work. In fact, I tried about 5 different working copies to paste into and they all failed with that authorization error. I know the properties file is exactly correct with the token and such.
I'm not sure what to do at this point, I haven't come across any logs on the server that indicate any good information to me unless their is a log I'm unaware of.
# Token
sonar.login=SOMESECRETTOKEN
# Unique project key for sonar
sonar.projectKey=SOMESERVICE
# UI Settings for sonar
sonar.projectName=SOMESERVICE
sonar.projectVersion=SOMEVERSION
# Path to source, if not set it searches from this
# file's directory
sonar.sources=.
# Encoding of the source code. Default is default system encoding
#sonar.sourceEncoding=UTF-8
#Cop
sonar.stylecop.projectFilePath=./SOMEPROJ.csproj
sonar.cs.fxcop.assembly=./bin/Release/SOMEDLL.dll
sonar.cs.fxcop.fxCopCmdPath=C:/Program Files (x86)/Microsoft Fxcop 10.0/FxCopCmd.exe
sonar.fxcop.assemblies=./bin/Release/SOMEDLL.dll
Any helps or pointers is appreciated, thanks!
This isn't about your encoding or file contents, but about permissions. The user that runs the scan doesn't have Execute Analysis permissions on the projects in question.
And to create new projects with the first analysis, the user must also have the Create Projects permission.
When encountering this issue, I loaded the file in Notepad++ which told me the file was saved under some strange encoding visual studio gave text files. I fixed it by switched the encoding to UTF-8 which resolved the problem. This probably should be handled better in Sonar!

Automated tests in one project run in a different directory

I am running a set of tests for work that I inherited from the prior testing. Most of the tests run fine from the central bin directory. One project, however, always fails because the current binary location (as seen by checking the value at Assembly.GetExecutingAssembly().Location) is showing up in temp directory like "TestResults\username_OPSNASJVJBX06 2016-02-18 11_40_06\Out\" off of the solution directory instead of in bin. I've tried recompiling. I've tried changing the project settings. I've tried modifying TestSettings.testsettings as per a handful of other people who've run into this issue. None of it is solving my problem. The most frustrating part is that this did work about two weeks ago, but I couldn't figure out what I'd done to fix it, and it later seemed to revert back to using this directory.
I have checked the project settings and not only are all of the test projects set to export to the ..\bin folder, but this test project's files show up there correctly.
As it turns out, the project was not set to use the TestSettings.testsettings. The path was absolute, not relative, so when I copied it to the test box, the link broke, quietly turning off use of TestSettings.testsettings.

PBXCp error no such file or directory

I'm getting this PBXCp error saying there is no such file or directory even though i checked and the file is there. Tried going into targets and Copy Bundle Resources deleted the file in question from there and adding it again did not solve the issue. Any help is appreciated.
PBXCp is a build utility; it copies files.
Your error is caused by it trying to copy a file, and not being able to put the file at the indicated place.
For instance: I'm getting this error as I try to build an extension for an App that is not building; my issue was that PBXCp is trying to install the extension, which did build properly, into an app bundle (essentially, a directory) that doesn't exist, which fails.
Since you're using CocoaPods, check to see whether anything needs updating or reinstalling. You could also be getting this error if you are using multiple schemes, and the results of one build are needed by a later step. If the first build fails, this error will occur in the later build step.
I had the same issue, just find unnecessary files (they have red title name color)
I had similar issue after I added some extra files in my project by copy pasting them from another. Like suggested by many others, I tried to find the faulty file by checking in Project settings- Building Phases. Dint work. While copying, I also had copied a view controller in my storyboard. I reverted my change and re did it. Worked. May be I made some mistake while changing identifier name or something. Don't know. But if nothing works and u can't figure out what's wrong, undo and redo the copying again step by step. Hope it helps someone.

ClickOnce Error "different computed hash than specified in manifest" when transferring published files

I am in an interesting situation where I maintain the code for a program that is used and distributed primarily by our sister company. We are ready to distribute the program to all of the 3rd party users and since it is technically our sister companies program, we want to host it on their website. (in the interest of anonimity, I'll use 'program' everywhere instead of the actual application name, and 'www.SisterCompany.com' instead of their actual URL.)
So I get everything ready to go, setup the Publish setting to check for updates at program start, the minimum required version, and I set the Insallation Folder URL and Update Location to "http://www.SisterCompany.com/apps/program/", with the actual Publishing Folder Location as "C:\LocalProjects\Program\Publish\". Everything else is pretty standard.
After publish, I confirm that everything installs and works correctly when running directly from the publish location on my C: drive. So I put everything on our FTP server, and the guy at our sister company pulls it down and places everything in the '/apps/program/' directory on their webserver.
This is where it goes bad. When I try to install it from their site, I get the - File, Program.exe.config, has a different computed hash than specified in manifest. Error. I tested it a bit, and I even get that error trying to install from any network location on our network other than my local C: drive.
After doing the initial publish in visual studio, I have changed no files (which is the answer/reason I've found by doing some searching about this error).
What could be causing this? Is it because I set the Installation Folder URL to a location that it isn't initially published too?
Let me know if any additional info is needed.
Thanks.
After bashing my head against this all weekend, I have finally found the answer. After unsigning the project and removing the hash on the offending file (an xml file), I got the program to install, but it was giving me 'Windows Side by Side' Errors. I drilled down into the App Cache were the file was, and instead of a config .xml file, it was one of the HTML files from the website the clickonce installer was hosted on. Turns out that the web server didn't seem to like serving up an .XML (or .mdb it turns out) file.
This MSDN article ended up giving me the final solution:
I had to make sure that the 'Use ".deploy" file extension' was selected so that the web server wouldn't mangle files with extensions it didn't like.
I couldn't figure out why that one file's hash would be different. Turns out it wasn't even the same file at all.
It is possible that one of the FTP transfers is happening in text mode, rather than binary?
For me the problem was that .config transformations were done after generating manifest.
To anyone else who's still having trouble, five years later:
The first problem was configuring the MIME type, which on nginx (/etc/nginx/mime.types) should look like this:
application/x-ms-manifest application
See Click Once Server and Client Configuration.
The weirder problem to me was that I was using git to handle the push to the server, i.e.
git remote add live ssh://user#mybox/path/to/publish
git commit -am "committing...";git push live master
Works great for most things, but it was probably being registered as a "change," which prevented the app from installing locally. Once I started using scp instead:
scp -r * user#mybox/path/to/dir/
It worked without a hitch.
It is unfortunate that there is not a lot of helpful information out there about this.

Referenced DLL is copied to output directory but not included in ClickOnce deployment

I'm having trouble deploying QuickTime references using ClickOnce in VS2010. The app runs just fine when run locally, but not when deployed. I tracked it down to a missing DLL during installation.
These are the included references in my project:
AxQTOControlLib
QTOControlLib
QTOLibrary
When I publish my app, it creates:
AxInterop.QTOControlLib.dll.deploy
Interop.QTOControlLib.dll.deploy
Interop.QTOLibrary.dll.deploy
The problem is when I actually install the app Interop.QTOLibrary.dll.deploy is nowhere to be found in the installation directory.
The other thing I noticed is in Publish -> Application Files, Interop.QTOLibrary.dll is not listed.
I've tried adjusting the Isolated value but that doesn't have an affect. I also tried manually including Interop.QTOLibrary.dll but then I hit hash mismatch issues.
Any ideas? Thanks in advance!
After several hours of fiddling, I got it working.
The fix was to set Copy Local = true and Isolated = true for all 3 QuickTime references.
I also manually included a copy of Interop.QTOLibrary.dll but set Build Action = None and Copy to Output = Never per these instructions: http://social.msdn.microsoft.com/Forums/en-US/winformssetup/thread/fcb2008b-e442-4c49-aa7a-0acb1ef0e210. Not sure if that helped though.

Resources